div's style.width help
I have 2 divs both hidden and absolute and sitting inside a relative div.
document.getElementById("div_1").style.right - nothing is returned, so I can not position the second div.
I think this may be because the first div width is always different - depending on the contents it holds and doesn't have a defined style="width:###" attribute etc.
Can somebody help, I am fairly new to divs and CSS.
If an element doesn't have a width, you can't fetch the width either.
makes sense...so if you want to have a div that changes size depending on the content what would be a way of going forward. Obviously you need to define a width programatically but how do you know what to define it so that the innerhtml content fits. if that makes sense :)
I wouldn't know, to be honest, but it doesn't seem very practical - for example, if the width takes up the entire screen width, then you'd have horisontal scrolling.
I know in this case the width would never fall over 800 pixels etc..
hmm hopefully there is a work around for such a situation.