Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 0.4 — Inspecting CSS in DevTools
CSS · Example 3 of 3

States to force with :hov

Inspect the link, click :hov in the Styles pane and tick :hover, then :focus-visible. The page shows those styles while you move the mouse away and edit them.

DevTools shows every rule that matches an element, which declarations won and which were crossed out, the final computed values and the box model, and lets you edit and toggle styles live to find out why something looks the way it does.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

In the first example, without touching the HTML, make the button orange again by editing only the CSS. Give two different ways.

02

In the second example, change the CSS so the box's visible width is exactly 300px, keeping padding: 16px and the 4px border. What width do you need?

Explain it without notes

01

How do you find out why a CSS declaration isn't taking effect?

02

What is the difference between the Styles pane and the Computed tab?

03

What does it mean when a declaration is crossed out, and when it has a warning icon?

States to force with :hov

Preview

Press Run to see the page.

Console

Nothing logged yet.