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 trialFelipe Pedro Jose Ostos Bermudez
3,119 PointsWhat is definition of Descendant Selectors?
What is definition of Descendant Selectors? thanks.
1 Answer
Ken Alger
Treehouse TeacherFelipe;
Descendant Selectors, or Combinators, describe the descendant of an element and can be used for styling elements that exist inside of other elements.
For example:
.body-text p {
color: red;
font-weight: bold;
}
<div class="body-text">
Howdy
<p>I am red & bold!</p>
But not me.
</div>
Only the p
elements that are descendants of the body-text
class get the styling applied.
Does that make any sense?
Happy coding,
Ken
Ivana Lescesen
19,442 PointsIvana Lescesen
19,442 PointsKen Alger Guil Hernandez Hello teachers, is it true that All CSS rules are read right to left which means that the computer has go thorugh all the p elements to find the : .body-text p. Would it not be easier to use classes? Thank you :)