May 8, 2008 at 2:46 pm #22653
The other day I had to resize a site built with tables and a little CSS.
the programmer had set the body width the the formerly desired size, something like 780px, and had given that a margin of 0 auto achieving the centered layout commonly used.
it confused the heck out of me bc i havent done that this way before and i thought it was a little goofy. i always use a container and to wrap everything and set that but it made me think. in terms of semantics do we need that container div?
he had a bkgd color for the body despite having a smaller width, the color filled the entire page. i can only assume a the effect would work for images, however even if that did not work you could apply the images to the html, which a lot of people dont use.
so essentially what im getting at is the body of any website is the body. and if the content, the body, needs to be 960px wide, shouldnt that dictate the body being 960px? and the bkgd be applied to the html level? skipping the container div all together?
in terms of semantics, this makes much more sense to me despite initially thinking it was stupid. now there may be some bugs and breaks that have lead probably most of us to using a container div and setting the width there. but typically when a person thinks of "the body" they think of the content weather it be images or type. the body IS the site not just the base upon which the content has been laid on.
maybe im talking crazy and maybe theres a very good reason for using a container div.
his reasoning was that he didnt like doing the text-align:center for the body and resetting it with left on a container. he didnt trust it haha. regardless ive been thinking about it and wanted to share. see what you guys think.May 8, 2008 at 8:36 pm #47379
all good stuff.
So far i have yet to test any of our new sites in 5.5 as nobody has requested it. I’m hoping with 8 gaining some ground in the future this will seal the deal on anything below 6 and then something like what we’re talking about will for sure not be an issue.
there are some instances where using different types of bkgd’s will probably require the use of a container div,
but if you dont mind sacrificing IE5.5, which i dont haha, this would seem a more semantic approach that is a fairly new concept to me.
I took a look in the other browsers and it does work in the major ones but falls apart in 5.5.
you could still set your maincontent and sidebar to the desired widths and they would work, they would just lose the centered alignment.May 9, 2008 at 6:29 am #47391
It’s a good semantic way of getting rid of an unnessecary wrapper-div. And when it comes to IE5.5 users…well…yeah?
You must be logged in to reply to this topic.