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 trialSpencer Renfro
Courses Plus Student 11,133 PointsHow could I use the square bracket attribute selector un place of Guils' code
So in the video Guils' code is:
.col:not(:first-child), nav a:not(:first-child){ margin-left: 15px; }
I was trying to do this part on my own using the attribute selector and I can not get it to work.
col:not(:first-child),
nav:not(:first-child + a[href*='col']){
margin-left: 15px;
}
I have also tried to comma separate after :first-child
col:not(:first-child),
nav:not(:first-child, a[href*='col']){
margin-left: 15px;
}
Just really curious how this code should be written the correct way to get the same result
1 Answer
Steven Parker
231,248 PointsIt looks like you're trying to add an attribute restriction to the original code, so you only need to add the brackets to what was there before, placing them directly after the tag name:
nav a[href*='col']:not(:first-child) {
If that's not it, please be more specific about what behavior you are attempting to create.
Spencer Renfro
Courses Plus Student 11,133 PointsSpencer Renfro
Courses Plus Student 11,133 PointsYes that was exactly what I was trying to do, thank you so much!