When is it a good idea to use the CSS display property?

Posted by allyourcode on Stack Overflow See other posts from Stack Overflow or by allyourcode
Published on 2010-03-18T08:38:35Z Indexed on 2010/03/18 8:41 UTC
Read the original article Hit count: 161

Filed under:

I think I first learned of this property when I thought "I should put this list of items in a ul, but I want it to be laid out horizontally. I wonder if I can do that with CSS?" When I googled this, I found a couple of sites suggesting that I create a CSS rule that would change the value of the display property of the li elements to inline. I've also seen the suggestion that a div (or other block element) be given display: table-cell in order to force the vertical align property to work. These techniques seem kind of hacky. Does that make sense?

This might not be a good analogy, but it seems like trying to ride a car as if it were a motorcycle. Yeah, I could replace the steering wheel with handle bars, wear a helmet, and remove all the passenger seating, but how the heck is a car going to drive on two wheels??

© Stack Overflow or respective owner

Related posts about css