Table vs. Div Design Philosophy?

Tony Jenkin

New Member
I haven't made a website in a very long time. I recently got back into it and before I brushed up I just jumped right in and started throwing tables in just how I used to. The problem I came up with is that on some of the pages of my website there is no scroll bar, and on other pages there are. So when you go from one page with out a scroll bar to one with a scroll bar the whole page shifts left the width of the scroll bar. Which gives the page a little nudge that I don't like. I thought I should just fix this by having all my pages height big enough that it needs a scroll bar, but then, what about people with really big monitors. So I thought I should do it the right way.

The question I have, I pretty much already have an answer. Div tags will fix this.

But I really want to know how and why. Why does a table centered not adjust correctly and nudges when there is a scroll bar and a website set up with div's doesn't nudge with or without the scroll bar?

Like I said it has been a while for me. So If someone could explain this to me in detail in layman that would be much appreciated. Thank you!
 

CaldwellYSR

Member
Tables were made to hold data. Not form layouts. It's just not the way it's supposed to happen semantically. Not much needed other than that. Use the correct tags.
 

Phreaddee

Super Moderator
Staff member
this old chestnut never dies!

firstly, clarification.
divs will do the same behaviour. why? 100% is the viewport NOT the screen.
an auto margin will centre a website in the centre of the viewport. take 24px out of the viewport and it'll shift 12px to the left. thats just the way it works.

I'm not even going to get into this discussion as it really gets me going so...
tables break! always!
tables should be used for tabular data only.
replacing tables with divs is not the answer


replace the table with semantically correct markup. (you can do it all without a single div or table) its about the separation of markup and content...
 
Top