Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Alcibiades Montas
Alcibiades Montas
5,974 Points

CSS: Table Displays...WHY?

On the new CSS layout techniques Guil goes over using CSS table displays element. He doesn't spend much time saying why however?

Why is this helpful? Why should I use it at all? What advantages does it have?

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Hi Alcibiades Montas,

The example I gave is pretty much the best use case for using table display – vertically centered content, like James Barnett mentioned. :)

4 Answers

James Barnett
James Barnett
39,199 Points

Display table has some neat tricks in terms of vertically centering divs.

Like this:

Imgur

working demo: http://codepen.io/jamesbarnett/pen/hDCsm

Here's a good article that also talks about this http://davidtanzer.net/css_valign

Wade Christensen
STAFF
Wade Christensen
Treehouse Teacher

This might be the kind of info you're looking for. This blog is great in general, and I think Chris has done some guest interviews for Treehouse.

http://css-tricks.com/complete-guide-table-element/

Best,

Wade

Alcibiades Montas
Alcibiades Montas
5,974 Points

Thank you guys, just want to know when to use what.....and since CSS has the option to display as a table wanted to know when to use it....Grid based design works for me best...but always good to know.

Ryan Sager
Ryan Sager
2,480 Points

I'm not sure I completely understand your question, but even though most web design has gone away from table design, there's still some instances where it's necessary, and good to know.

If you'll ever be doing HTML for emails, you'll need to know table design because some email clients will only render table design properly, and will ignore modern design.

There's also some circumstances where table design will just make sense. If you have some data or information that requires a lot of rows and columns, it could potentially be easier to use a table.

If this doesn't answer your question I'm more than willing to try again :)

James Barnett
James Barnett
39,199 Points

Ryan Sager -

display: table is a CSS property to be confused with the HTML element <table>