alcatraz678 — 2008-12-10T09:08:12-05:00 — #1
Why do most developers put this div wrapper on most of their websites?
I don't know what's the point, please tell me why!
nick — 2008-12-10T09:23:56-05:00 — #2
A lot of sites don't span the full screen length (i.e. fixed width sites), so webmasters use a "wrapper" to set the appropriate width and act as a full screen would. Something I do from time to time:
width: 760px; }
<div id="wrapper">main html here</div>
Not a perfect example but it gets the point across. It's probably bad practice to include all the page HTML in between <center> tags.
jemple — 2008-12-10T09:34:18-05:00 — #3
Its a way of controlling the overall width and dimensions of a page by wrapping it in a 'container'.
alcatraz678 — 2008-12-10T11:37:52-05:00 — #4
icic, thanks. this is useful!
autisticcuckoo — 2008-12-10T11:40:50-05:00 — #5
I think it's primarily because Internet Explorer (version 7 and older) have a number of annoying and frustrating bugs when it comes to styling the
body element. Therefore you need an extra container around the whole content if you want to, e.g., centre the page or specify min/max width constraints on it.
webcosmo — 2008-12-10T12:08:07-05:00 — #6
very right. for example text-align:center; on IE would give a annoying horizontal scorllbar although places the content in center.
black_max — 2008-12-15T23:02:46-05:00 — #7
work in strict doctypes any longer?
tyssen — 2008-12-16T00:20:13-05:00 — #8
It'll work but was deprecated with HTML 4 so shouldn't be used - that's what CSS is for.
autisticcuckoo — 2008-12-16T02:01:33-05:00 — #9
Yes, it will work in browsers that support
<center>. Browsers don't care what doctype you use (other than to choose between quirks mode and standards mode). If they support
<center> those tags will work even if you declare the doctype as Strict.
They are deprecated for a reason, though. As Tyssen said, that's what CSS is for.