Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

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. :)