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

Paul M
Paul M
16,370 Points

How to fix a float flip-flop when setting the display value to inline-block

I am working on a website with a navigation bar which I set as inline-block. But when I did that, all the list items went the opposite way or flip-flopped. Is there another way to fix this other that reversing all the list items in the HTML?

Idan Melamed
Idan Melamed
16,285 Points

Maybe you can float the nav-bar instead of using inline-block?

1 Answer

If they were set to float: right, then no, that's just the way that float works, with the first item in the source code being closest to the edge that the items are floating to.

display: inline-block will just put items on a line like any regular sentence would. You might be able to play with the actual reading direction of the text, but I imagine it would be messy, since you'd have to make sure the container goes right-to-left while the individual items read left-to-right...

If you did want to play with that, you're looking for the direction property.