If you do:
<div style="width: auto; background: red; color: white">test</div>
You get a div that is stretched to fill the entire screen width (100%). That is what I need to happen.
However, I also need the starting position to be set. So, I need position: absolute
.
When I add position:absolute, the width of the div
is only as wide as the content within (similar to floats). Is there any way around this?
I cannot simply specify width: 100%
since this does not take in to account border sizes, etc.
When I add position:absolute, the width of the div is only as wide as the content within.. (Similar to floats). Is there any way around this?
I cannot simply specify width:100% since this does not take in to account border sizes, etc..
You could use position:absolute; left:0; right:0; top:0
.
Like this: http://jsfiddle.net/thirtydot/yQWGV/