MyBB Community Forums

Full Version: CSS vs. table layout in modern world
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Many of the designers/starters i meet think that DIVs are better and more 'standard' than tables

Now this is true for content. But what about layouts? Look back in time and realize how easy it was to create a two column layout in which the two blocks covered the page fully. Try it divs.....you'll end up finding a 'way' or hack to do it. Like absolute position or similar stuff.

Yes, DIVs are good for general purpose and reduce code but they still don't defeat tables when it comes to layout.
Let's get real; you still use tables for forms...don't you?
I sometimes find myself afraid to use tables like they are deprecated lol

Some say table bloat the code. I believe reverse. You will up writing even longer code to make complex layouts with DIVs.

Cons of Divs:
  • no vertical-align
  • Bad for symmetrical layout
  • hacks required to achieve even the simplest layout sometimes
  • using positioning sometimes gives inconsistent results across different browsers and screen sizes

I'm not saying tables are perfect. They do have their share of problems...but they are better way to make layout...even if it's not tabular data.

What do you prefer? Tables or Divs?
Why is this even a question? Tables are for tabular data. You can't prefer them over divs for layout, because they're not meant to be used for layout. It's semantically incorrect. And it's not that hard to create layouts with divs. If you can't be bothered to do it, use a grid system. I honestly don't understand why this is still being discussed.

Anyway, CSS3 is introducing flexbox and a bunch of other nice things that will make all of this obsolete.
I do prefer tables actually. Divs sometimes create mess than being any useful.
Tables are fine if you know how to stylize them in an appealing way.
(2012-09-30, 06:42 PM)Fábio Maia Wrote: [ -> ]Why is this even a question? Tables are for tabular data. You can't prefer them over divs for layout, because they're not meant to be used for layout. It's semantically incorrect. And it's not that hard to create layouts with divs. If you can't be bothered to do it, use a grid system. I honestly don't understand why this is still being discussed.

This x100. Isn't really a question that needs asking. That said apparently Google doesn't know (The comments are worth reading, it's some good discussion):
http://forrst.com/posts/Why_would_Google...es_for-2kD
(2012-09-30, 06:42 PM)Fábio Maia Wrote: [ -> ]Anyway, CSS3 is introducing flexbox and a bunch of other nice things that will make all of this obsolete.

New web technologies take time to come to regular use...give the need to make stuff compatible for older browsers
I lolled. Surely you're joking?

Tables contain data only. Divs should be used as generic containers. Otherwise you should use eements as they're meant to be used: <p> for paragraphs, <span> for inline spans of text etc. You should use the right element for the data it contains and styling and positioning should be controlled by CSS.
(2012-09-30, 08:18 PM)euantor Wrote: [ -> ]Tables contain data only. Divs should be used as generic containers.

By 'content' i didn't mean paragraphs and text. I meant to say in general....same as what you are saying. I'm talking layouts, blocks
Still not good practice then. You're still wrapping non-tabular data in a table which is not semantic. Maybe this will help you: http://www.webdesignfromscratch.com/html...ml-tables/ - especially the section titled "Tables should not be used for layout
"
I'm new to code and Divs are very easy.
Pages: 1 2 3 4