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.


Floating Values make a mess

Hello guys,

So I am trying to make a navigation bar but I am having problems trying to float my unordered list to the right.

I have the following code http://codepen.io/anon/pen/ldrLH CSS starts at line #426, everything before it is normalize.css

When I float left the ul, it makes the black nav invisible.

2 Answers

Joe Timmons
Joe Timmons
4,331 Points

Hey Alejandro, I know of two possible fixes for this.

1st: Using the "clearfix" method: http://codepen.io/anon/pen/lEsKH

2nd: Text-align everything in your container to the right rather than using float: http://codepen.io/anon/pen/KfmJl

Maybe someone else can let us know which solution (or other) is currently the preferred method. You can read more about the clear property here: http://css-tricks.com/all-about-floats/ under the section called The Great Collapse for the issue you are seeing.

Hope this help!


Thank you so much!