10

Recently I asked a question here and one of the answer suggests to use display: table and display: table-cell css properties.

Generally UI designers recommend not to use tables for layout. What if I use these two css properties extesively while layout? Is it the same as using tables for layout?

3
  • What you call "extesively" ? You may use <table> for tabular data and CSS displays to get things like vertical-align or fill remain space no more. Commented Dec 19, 2013 at 12:39
  • Possible duplication: stackoverflow.com/questions/6629857/… or stackoverflow.com/questions/6307934/… Commented Dec 19, 2013 at 12:39
  • @Danko I meant can I use display: table and display: table-cell always whereever possible while layouting the page. Commented Dec 19, 2013 at 12:42

2 Answers 2

17

No. HTML tables indicate that their contents are tabular data. This information is exposed to the Accessibility API and so accessibility tools like screen readers can tell their users what to expect in the information following. Note that cell headers may be read out multiple times so that the AT user can orientate themselves while following the data.

CSS tables do not behave like that. They are just layout instructions. The information about the data that the AT user gets will reflect the semantics of the HTML, not the CSS layout.

Sign up to request clarification or add additional context in comments.

Comments

3

The display table let the element behave like a element without using a HTML table element, so probably you will have more flexibility on your development. So you will have the benefits of a table and the flexibility of development without table, becase tables are always difficult and and hard to work

2 Comments

Sorry, I find this answer unsatisfying. Do you mean "division" (div) instead of "development"? What is the supposed flexibility? Why are tables "always" difficult to work with? I honestly don't know the answer.
If you never intend to edit the layout of a page, or you have some WYSIWYG solution (who knows, maybe Frontpage will come back one day), tables are very easy to work with. The trouble comes once you realize you want to change the page layout and have the choice of changing flex-direction or whatever in your CSS, or digging through a bunch of nested HTML. That said - if you arrive at a solution that's easier to understand as a table, use a table. If it's easier to understand as CSS, use CSS. Write code because it's easy to read in 6 months, not because tables are "outdated" or something :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.