Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was referred here from stackoverflow as my question was apparently too broad.

I'm working on a template, and I know using CSS is preferred over HTML tables for positioning... But, is it acceptable to get the best of both worlds and use table-like styles on my divs? For example:

display: table;

This not only helps solve the sticky footer problem, but it also avoids the pains associated with using floats. Somehow it feels dirty, but I can't logically explain why because it works without any "tricks" or ugly hacks, which is how it should be, right?

Is this technically incorrect, or does it ultimately boil down to just a matter of opinion? ...Thoughts?

share|improve this question
Don't forget about using table layouts for email! –  Mikhail Nov 16 '12 at 3:23
Yes! Please use them if you're not supporting IE<=7. CSS has nothing to do with that issue, which went on and on for years, in part because the one argument the tables-as-layout douchebags had that we couldn't really challenge was that you couldn't vertically center in IE without explicit heights set because !@#$ing IE took 10 years after Netscape Navigator implemented to finally put table-display in a version of IE with IE8. So please use it. Revel in the vertical centering glory. Unless of course you actually need a table. Then use table HTML. –  Erik Reppen Nov 26 '13 at 8:43
@ErikReppen - Thanks for confirming my hunch that the debate in question was fueled as much by personal animus ("tables-as-layout douchebags") as by any technical concern. –  user1172763 Oct 22 at 21:02

2 Answers 2

up vote 2 down vote accepted

Using tables for layout is discouraged because it is semantically wrong -- table markup is supposed to be for tables and specifically for tabular data. Your HTML says what something is (e.g. a table, a paragraph, or a generic text division) CSS is just instructions for displaying it.

If it's consistent across browsers that are important to you, whether it's displayed as a block or a table is no different than whether it's displayed in red or green. Table and table-cell display properties are often cited as good methods for dealing with problems like vertical centering.

share|improve this answer

IE7 doesn't support 'display: table', so you can only use it for IE8 and up. Other browsers handle it fine, mostly.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.