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 trialanonymous123
5,794 PointsCreating a Horizontal Navigation with Floats
how come when i float a ul element containing to the right and then float all the list items to the left they appear right next to each other in a section of the screen that wasnt part of the ul element?
1 Answer
Michael Shields
12,650 PointsWhen we float this ul element to the right, we're pushing it out of the normal flow and to the right of its container, <div class="container">, of which the <ul class="main-nav"> element is a descendant. The parent element's height also collapses with the float, so the <ul> is a child element in the layout.
I recommend having Dev Tools open while following and coding along, I find it very helpful for quickly understanding the behind-the-scenes changes that occur while updating the layout.