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 trialGiovanni Valdenegro
13,871 PointsWhy are classes declared such a main-nav and main-footer
Why is he using main-nav and main-footer classes instead of simply using the <nav> element or just <footer> element and then make a rule such as:
nav {} or foother {}
Why? main-footer{} and main-nav{}???
Also why does he not used IDs only Classes for example the wrapper if there is only one wrapper on the page?
Help much appreciated
2 Answers
Nkosi Ndlovu
9,652 PointsHi Gio, You can use footer and nav many times on a page. For example : a section can have a footer and a nav, an article can also have both(footer,nav). So if he had styled main-footer as footer it will apply to all the footers.
With regards to ids, I think you are only meant to use them once. Make sense?
Adam Kerr
11,850 PointsTypically you style using class selectors since they are reusable on the same page. Since IDs are supposed to be unique and only one instance per page they are normally used more for JavaScript.