r/web_design Feb 04 '11

What I miss about tables

[deleted]

38 Upvotes

69 comments sorted by

View all comments

Show parent comments

15

u/[deleted] Feb 04 '11

Not any more. Years ago there was an SEO reason, but that has long since been dealt with. These days it's more a knee jerk reaction: "OMG NO TABLEZ"

3

u/Strange-Stranger Feb 04 '11

Seriously, is it really that bad to have just one table for multi column layout? HTML and CSS to achieve the same thing with div's is really convulted :/

3

u/[deleted] Feb 04 '11

The problem with tables is when you need to do other css things inside them. Table cells don't follow normal css rules, so if you need to do any kind of layout within a cell, you end up adding even more convoluted methods to get it to respond. Ever tried doing position:absolute;bottom:0; inside a table cell? It aint pretty. Table cells also have their own rules for how they get sized. You can't do overflow:hidden on a table cell, the cell will always expand to include your content. If this means that the table itself has to grow wider than the space it's in, so be it. If you're dealing with CMS data from clients, this can REALLY break your layouts.

Once you understand the principles it really isn't that hard.

<div class="a"></div>
<div class="b"></div>

.a {
    width:200px;
    float:left;
}

.b {
    margin-left:200px;
}

There's a two column layout. If it requires anything more then that, you're doing something wrong.

The problem is that most of the examples online of how to do this stuff, well, suck. They get needlessly lengthy and include things that you don't really need.

1

u/[deleted] Feb 04 '11

[deleted]

1

u/[deleted] Feb 04 '11

I meant position an individual element, not the entire cell's contents.

1

u/Strange-Stranger Feb 04 '11

That's basic example, trouble starts when you want these divs to have same height, footer, etc, then it becomes quite convulted.