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 trialweb pad
4,483 PointsWhen writing pseudo class inside an element, do we need to put a space? Nick did not put a space between the anchor tag.
In the video, Nick wrote the tag nav a, nav a:visited { color: #fff;} He did not put a space between the <a> and the colon: Will it render a different code if I put a space after the tag, before I write the ":visited" , so then it will be like this ---> nav a, nav a :visited ?
1 Answer
Steven Parker
231,248 PointsA space in a CSS selector indicates an ancestor/descendant relationship. The rightmost term is the target, and the term on the other side of the space is a parent or further ancestor of the target. Without a space, the selector refers just to the target. For example:
-
nav .here
targets an element with the class "here" that is inside anav
element -
nav.here
targets a nav element that has the class "here" -
nav a:visited
targets an "a" element that is in the "visited" state that is inside anav
element
web pad
4,483 Pointsweb pad
4,483 PointsThank you so much. This makes it clear now