
The first three exercises cover intermediate CSS. The remaining four work with sizing functions, custom properties, transitions, and visual effects. Write your own solution before opening the example.
1. Use media queries
Match the three viewport arrangements shown in the reference images. Start with one column, then adjust the layout where space permits.
Show one possible solution
@media (min-width: 48rem) { .layout { grid-template-columns: 2fr 1fr; } }2. Style buttons with different cursors
Give the buttons distinct purposes and pair cursor styles with accessible labels and actual states.
Show one possible solution
.move-button { cursor: move; }
.help-button { cursor: help; }
button:disabled { cursor: not-allowed; }3. Practice attribute selectors
Mark an item based on a custom attribute and test exact, prefix, and substring matching.
Show one possible solution
li[data-status="done"] { font-weight: bold; }
li[data-code^="lab-"] { color: #174484; }4. Combine fixed and fluid sizes with calc()
Give one panel a fixed reference width and compute the other from the available width. Let the panels stack on a narrow view.
Show one possible solution
.fixed { width: 10rem; }
.fluid { width: calc(100% - 11rem); }5. Reuse colors with custom properties
Choose common colors, declare them once, and use var() in the heading, card, and button rules.
Show one possible solution
:root { --accent: #2164af; --surface: #eef4fa; }
.card { background: var(--surface); }
.card h2 { color: var(--accent); }6. Animate a navigation menu
Add a subtle transition to a menu link and provide reduced-motion behavior. Test focus as well as hover.
Show one possible solution
.menu a { transition: transform 160ms ease; }
.menu a:is(:hover, :focus-visible) { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .menu a { transition: none; transform: none; } }7. Combine shadows, gradients, filters, and a tooltip
Use a shadow on the card, a gradient behind a heading, and an image filter. Keep tooltip text accessible on keyboard focus as well as hover, or use an always-visible explanation.
Show one possible solution
.card { box-shadow: 0 4px 12px #0002; }
.card h2 { background: linear-gradient(90deg, #dceeff, white); }
.card img { filter: grayscale(.25); }For more practice with the basics, see the worked beginner exercises.
Original CodePen examples
Visual references from the original lesson


