Descendant Selector: element1 element2

Pattern:

element1 element2

 

Definition:

The element1 element2 selector matches every element2 that is the descendant of element1. A descendant selector is made up of two or more selectors separated by white space.

 

Examples:

Style every <a> element that is inside <p> elements

p a { color: greenyellow; }

Style every <em> element that is within a <p>, and is a grandchild or later descendant of a <div>

div p em { text-decoration: underline; }
w10schools
2014-11-09 17:07:28
Comments
Leave a Comment

Please login to continue.