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 trialDimitris Karatsoulas
5,788 PointsDifference between nav and div elements.
So, we had to apply a certain width on . primary and .secondary so that float could work for them and have the desired two-column layout. On the contrary, we didn't have to apply any width on .main-nav li elements when we were setting up the navigation layout, float: left worked just fine. Why is that?
1 Answer
Dimitris Karatsoulas
5,788 PointsActually what I meant is that I don't understand the difference in the behaviour of those elements. The divs .primary and .secondary need a width so that they can be displayed side by side, using float on them. Although we also use float on the li elements of nav but we don't have a width they are still displayed side by side.
Michael Fazekas
3,070 PointsMichael Fazekas
3,070 PointsMy best guess is if you just use <nav> and decide to update it with a log in button nested beside the nav it would probably push the nav property to the left of right and break your nav bar down. with a width of 100%. why you use containers to help hold certain elements inside that container that you want there. so you can add a login button or a input button to comfirm a email or something along those lines.