Structural pseudo-classes

:first-child and :nth-child — no extra classes needed

:first-child

li:first-child styles only the first item — stronger border, larger font-size, and more padding — without a special class (rule 47).

:nth-child(odd) / :nth-child(even) + :nth-child(3)

Zebra rows use background via :nth-child(odd/even). Row 3 also bumps font-size and weight with :nth-child(3) (rule 48).

Why this helps

Rules 47–48 in ../rules.md. Back to interaction states: 01-basics.html.

Important HTML

List items can be targeted structurally.

<ul class="tile-list">
  <li class="tile">…</li>
</ul>

Important CSS

Structural pseudo-classes style repeating items.

.tile:nth-child(odd) { background: #f8fafc; }
.tile:hover { border-color: #0f766e; }