Welcome to the Treehouse Community
Looking to learn something new?
Jacob Miranda18,783 Points
Layout: Float vs Display: Inline-block ?
I constantly see Float: Left/Right used for laying out sections of a webpage, but I have recently switched over to using the property/value pair of Display: Inline-block. Through my experience, I have found it to work better and is a lot less stressful when getting it to work properly. I also don't have to worry about clearfixes and any other headaches of forgetting to add something.
The one thing to keep in mind with displaying an element with inline-block is that you must have the closing tag and opening of the next element side-by-side.
<div>Hello world!</div><div>Hello other world!</div> A space character will be rendered as a few pixels and may mess up your layout a bit.
If anyone has an opinion of using one versus the other, please discuss!
Jeff Lemay14,267 Points
Using inline-block is used more now that box-sizing:border-box is available in more browsers.