Video tutorialTrack course · freeCodeCamp
Speed
Transcript & captions
3/3
| Selector | Matches |
|---|---|
| p | every <p> |
| .card | elements with class card |
| #main | the element with id main |
| [type="text"] | attribute match |
| a, button | grouping — both |
| div p | any p inside a div (descendant) |
| div > p | direct children only |
| h2 + p | the p immediately after an h2 |
| h2 ~ p | all sibling p after an h2 |
Try it yourself
Knowledge check
0/1 answeredWhat does div > p select?