Forum Moderators: not2easy
I am a fairly experience web developer but i have come accross a bit of an obstacle when trying to migrate an existing table site i have designed to a div / css based site.
Basically the site is a 900px wide table that is centered in the middle of the page with the body padding and margin set to 0 to give a myspace type layout where the header is at the top of the browser and the footer at the bottom with no padding or margin above or below.
To add a nice finsh to the site i wanted to add a drop shadow to this centered content to give a nice smooth transition to the body background color.
I have achived this using tables and having three <td> tags inside one table with the 1st and the 3rd one having a background image with a set width repeated to the bottom of the page (i forgot to mention this is 100% height page)
I have done alot of reading on the subject of div vs tables and have come to the conclusion i would like to use div's rather than tables.
I have included a link to a screen shot of the site showing what i would like this to look like and highlighted the area in question in red.
I would be extremley grateful if someone can assist me here.
<snip>
Kind Regards Greg Langford
[edited by: engine at 10:34 am (utc) on Sep. 19, 2008]
[edit reason] No links, please post code. See Forum Charter [/edit]
we will be stuck using a wrapper that's given the appropriate width and auto margins to center it and then inside that wrapper apply a background with the gradients applied to them on the edges. Use some padding to prevent the content to go over the gradient area.
Tip: take care not to fall from the abuse of tables into the abuse of divs. In the beginning, it's easy to forget you can layout any element, not just a div.
Do you mean say have an image as wide as the wrapper its self 800px and then do a backgound image that is repeated down the page? and have the padding inside there to stop the page going over the edges?
I thinks that's indeed what I was saying.
Is it bad pratice to use tables to layout a page?
Opinions will differ.
In my mind there's no question that
So in short my advice is: For something new don't use tables unless it's tabular data. For something old: don't go overboard getting the last table out of it, but if you have to tough it and are struggling with nested tables: it's high time for them to go.