How is specificity calculated for :is() and :where(), and how do they differ?
:where(#sidebar) a
:is(#sidebar) aRead the full question →CSS decides layout and paint. Most bugs come from the cascade, stacking contexts, and containing blocks rather than from the properties themselves.
Specificity maths, margin collapsing, what creates a new stacking or containing block, flex versus grid sizing, and which properties can be animated cheaply.
Where it shows up: Frontend roles, design-system teams, and anywhere responsive or themeable UI is built.
Twenty real CSS questions from the library, code snippet included. Nothing here is paraphrased for search engines. It is the same text a signed-in user sees.
:where(#sidebar) a
:is(#sidebar) aRead the full question →.card-wrap { container-type: inline-size; }Read the full question →.item { counter-reset: x 5; }
.item::after {
counter-increment: x 2;
content: counter(x);
}Read the full question →li:nth-child(3n+1)Read the full question →grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));Read the full question →.grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-areas:
"header header"
"sidebar main";
}Read the full question →:is(a, button):not(.sidebar a, .sidebar button) { color: red; }Read the full question →grid-template-columns: repeat(auto-fit, 200px);Read the full question →<form>
<input type="text"> <!-- input 1 -->
<input type="email"> <!-- input 2 -->
<input type="text"> <!-- input 3 -->
</form>Read the full question →<h2>Title</h2>
<p>One</p>
<div></div>
<p>Two</p>Read the full question →p {
color: #00ff0080;
}Read the full question →@keyframes c {
0% { background-color: black; }
50% { background-color: red; }
50% { background-color: blue; }
100% { background-color: white; }
}Read the full question →img::before { content: "\2605"; }Read the full question →.thumb {
width: 300px;
height: 300px;
object-fit: contain;
}Read the full question →.grid {
display: grid;
height: 600px;
grid-template-rows: 100px 1fr min-content;
}
/* row 3 content is a single line of 20px text, no padding */Read the full question →:where(.a, .b) > span { color: red; }Read the full question →h1 {
font-size: clamp(1rem, 2.5vw + 0.5rem, 3rem);
}
/* Assume the root font-size is 16px and is not overridden. */Read the full question →.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-areas:
"head head head"
"nav main main"
"nav foot foot";
}
.x { grid-area: nav; } /* element .x contains 'X' */Read the full question →<div class="parent-a"> <!-- opacity: 0.99; -->
<div class="a">A</div> <!-- position: relative; z-index: 9999 -->
</div>
<div class="parent-b"> <!-- no special props -->
<div class="b">B</div> <!-- position: relative; z-index: 1 -->
</div>Read the full question →.box { position: static; z-index: 5; }Read the full question →We keep the correct answer, the explanation and the scoring behind sign-in so the platform stays honest, which is why the answer options and the worked explanation for every CSS question stay behind a free account. Signing in is free and takes a few seconds.
43 distinct CSS topics are tagged across the library. These are the real topic labels stored on the questions, not a hand-written list.
…