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 trial

CSS

Recommend a project for reviewing advanced selector stage

There's just so much to remember in advanced selectors stage, I feel like I'll forget about them later, can you guys please recommend me a project where most of the advanced selectors will be useful or should be implemented, so that the whole stage can be reviewed in one go? Like in "how to make a website" stage

In my own opinion, while advanced selectors are powerful and can be very useful, the decision to use them or not comes down to whether you prefer to use classes for component styling or not.

For example, consider some html with a few paragraphs. Let's say you want to always style the last paragraph to something different. You can do this by choosing to either use the pseudo-class :nth-last-child or create a class with the styles you want and apply it to the last paragraph.

p:nth-last-child {
    color: red;
}
<body>
    <p></p>
    <p></p>
    <p>This text will be red</p>
</body>

... or ...

.last-paragraph {
    color: red;
}

/* or */

[class*="last-paragraph"] {
    color: red;
}
<body>
    <p></p>
    <p></p>
    <p class="last-paragraph">This text will be red</p>
</body>

As I gain more experience, I'm leaning more toward the latter example because it's easier to understand at-a-glance that there will be unique styles applied to the last paragraph.

thanks for such a detailed reply Robert

3 Answers

I like to keep websites like W3schools around for help remembering things like advanced selectors. Memorizing things is not really needed in the modern age, what is important is understanding concepts , knowing how to access the information need and knowing how to implement them.

http://www.w3schools.com/cssref/css_selectors.asp Is a great place to review advanced selectors.

I can't recommend a project, but making up a project on your own that implements them would be a fast way to learn them as you would have to think of creative ways to use them.

Thanks for replying Johanna,but the real problem i'm having is infact "making up a project on your own that implements them would be a fast way to learn them as you would have to think of creative ways to use them.",you can say i've reached a design block :D,the same way writers get a mental block

Maybe make a resume website, and use the selectors within to showcase your knowledge?

Wow I like that idea Johanna,thanks!

If you feel my answer was suitable, please choose 'best answer' next to my name :)