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

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!

-Joe

Thank you so much!