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 trial1 Answer
Joseph Lander
Full Stack JavaScript Techdegree Graduate 27,765 PointsTLDR: I don't think they had to OR they forgot to incorporate it OR they use it in later videos
I opened the workspace and see that there isn't a solitary .description
selector in the CSS. The button tag has been styled separately and there is no button.description
use. If you'd like to confirm this for yourself, I added a button element without the class name to the HTML and it styles the same as when it is included.
There could still have been other reasons they would want to add it here:
- If there were more buttons than there are in the example, this would allow them to use
button.description
. - They could have styled the button with generic styles, then add more specific styles on top of those.
- Equally, they could have used it for a more specific js selector.
As far as I see, the short answer, I think you spotted - it wasn't doing anything.
Joseph Lander
Full Stack JavaScript Techdegree Graduate 27,765 PointsJoseph Lander
Full Stack JavaScript Techdegree Graduate 27,765 PointsIn fact, they do use this in a later video "Styling Elements" at 9:09 when they add another button and it adds a bug to their new code.
I think this highlights that it's worth adding classes to your elements 1) so that you can refer back to them later and 2) so that they are more readable in the HTML as well.