Selectors lab
First paragraph.
Second paragraph with a link.
- One
- Two
- Three
CSS Studio
Interactive Learning
IDs beat classes, and classes beat elements. !important skips the cascade and makes later debugging harder — prefer higher specificity or better structure.
Selectors
Selectors decide which nodes your CSS touches. This playground pairs a live DOM tree with a selector input so tag, class, id, combinators, attributes, and pseudo-classes become visible instead of abstract. Type .card or article > p and watch matches light up. Then compare two competing rules in the specificity calculator — (a, b, c) shows IDs, classes, and elements so you can explain why one declaration wins. Practice :nth-child, :not, and ::before here before you debug production stylesheets.
IDs beat classes, and classes beat elements. !important skips the cascade and makes later debugging harder — prefer higher specificity or better structure.
0 matches
Rule B wins with (0, 2, 1) over (0, 1, 0).
First paragraph.
Second paragraph with a link.
<article id="post" class="card featured">
<h2 class="title">Selectors lab</h2>
<p class="lead">First paragraph.</p>
<p>Second paragraph with a <a href="#" class="link">link</a>.</p>
<ul class="list">
<li>One</li>
<li class="active">Two</li>
<li>Three</li>
</ul>
<form>
<label>Email <input type="email" name="email" /></label>
<label>Name <input type="text" name="name" /></label>
<button type="submit">Save</button>
</form>
</article>