Home
CSS
CSS Combinators
Tryit: The descendant selector
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> div p { background-color: yellow; } </style> </head> <body> <h2>Descendant Selector</h2> <p>The descendant selector matches all elements that are descendants of a specified element.</p> <div> <p>Paragraph 1 in the div.</p> <p>Paragraph 2 in the div.</p> <section><p>Paragraph 3 in the div.</p></section> </div> <p>Paragraph 4. Not in a div.</p> <p>Paragraph 5. Not in a div.</p> </body> </html>