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 How to Make a Website Styling Web Pages and Navigation Style the Portfolio

Anuj Taxali
Anuj Taxali
2,712 Points

Why floats?

Instead of floats, why can't we use display:inline block to align the images side-by-side?

1 Answer

Nicole Archambault
Nicole Archambault
27,848 Points

Hi Anuj!

This is a really great question. The fine folks over at Stack Overflow have discussed this before, and show some examples of where whitespace can be a finicky issue while using display:inline-block or display: table-cell. It depends on what you are trying to accomplish with the look of your site, and also established best practices or standards in the community.

Also, sometimes, you'll also find that more than one function will accomplish the same goal, but one is a newer standard and thus should be adhered to over the other. Changes can be purely semantic to make them more clearly understood (as in HTML5 tags, for instance), or they may offer fixes over previously-used tags.

If my answer was helpful to you, please be sure to vote/mark it as Best Answer. :)