Styling by Position
Sometimes it’s not possible to exactly annotate the markup that you want to style. It is possible to select a particular HTML element using positional selectors.
For example, styling the fourth element:
style.css
li:nth-child(4) {
color: oklch(0.707 0.165 254.624);
}
- this
- list
- has
- six
- elements
- apparently!