I can’t believe such a simple thing is causing me to lose sleep!
I just want a div layer that stretches the width of a page without scrollbars! That’s all!
Setting width: 100%; sure doesn’t work. Naturally
There are small gaps to the left and right of my layout. I tried specifying 0 for any type of margin, padding, or border, but still, no dice.
Anyway, I tried setting margin:left and right, which is partial success, because now the left side is reaching all the way to the edge of the browser. But the right side continues to elude me.
Just by looking at it… the coding in your site is really messy… and I’d just assume that it’s not your CSS but the styling done in your body on your DIVs. I would clean that up first and do it all in your CSS file.
Ok, now that I’ve done that (thank you Simplistik) the scrollbars do go away, but that ****able gap on the right side continues to dog me. If I extend the layer to 110% width - it will go all the way, but now the scrollbars show up again!
Hasn’t anyone in the history of the internet made a div layer stretch from left to right? I can’t even find anything on Google about this…
Width % is based on available parent width. if placed in the body tag, the div will only be able to match the width of the available width within the body. This is decided by the size of that parent and its margin and padding settings. By default the body tag has no padding, but it does have margins. Because of this, the div can only stretch to bodywidth-margins. Set your body margins to 0 and your div will fit to the screen.