Stop Guessing, Start Inspecting
Every layout bug you've hit in this course — a box that's wider than expected, a rule that isn't applying, text that won't center — has a definitive answer sitting inside your browser's DevTools. Learning to read it is faster than guessing and re-editing your stylesheet.
- ✓DevTools opens with F12, Ctrl+Shift+I (Cmd+Option+I on Mac), or right-click → Inspect.
- ✓The Elements panel shows live HTML and the CSS rules affecting whatever you've selected.
- ✓Changes made in DevTools are temporary — they reset on refresh, so edit your actual file once you've found the fix.
Reading HTML and CSS Side by Side
Selecting an element on the left shows every CSS rule affecting it on the right — in the order the cascade applies them, with overridden rules struck through.
A struck-through rule means it lost to a more specific one — exactly the specificity rules from Day 16. DevTools shows you the winner without any guessing.
Seeing Padding, Border & Margin Numerically
The Styles panel includes a small box-model diagram for whatever element you've selected — the exact same content/padding/border/margin layers from Day 18, but with real pixel values from the live page.
// Quick keyboard shortcuts worth memorizing Ctrl/Cmd + Shift + C // element picker — click anything on the page Ctrl/Cmd + Shift + M // toggle device/responsive mode Esc // open/close the console drawer inside DevTools
Testing Fixes Without Touching Your File
You can toggle, edit, or add CSS declarations directly in the Styles panel and see the page update instantly — a fast way to test a fix before committing it to your actual stylesheet.
Testing Media Queries Without a Second Device
Device/responsive mode lets you resize the viewport to test the media queries from Day 26 directly in your desktop browser, without needing an actual phone or tablet.
A Debugging Checklist
Breaking Down What You Just Learned
Opening DevToolsF12, Ctrl+Shift+I, or right-click → Inspect on any element.
Elements panelShows live HTML alongside every CSS rule affecting the selected element.
Struck-through rulesShow which declarations lost the specificity battle, and why.
Live editingTest fixes in the Styles panel before copying them into your real file.
Responsive modeTest media query breakpoints at exact widths without a second device.
Try It Yourself
Open any page you've built in this course, right-click an element, and inspect it. Find one CSS rule with a strikethrough and explain in your own words why it lost to another rule.
Debug a Deliberately Broken Page
Practicing the full DevTools debugging workflow
Create day29.html and deliberately introduce three CSS bugs to find and fix using DevTools.
- Build a small page with a header, a card, and a button.
- Introduce a specificity conflict where the wrong rule wins.
- Introduce a box-sizing issue where a box renders wider than intended.
- Introduce a positioning bug where an absolutely positioned element anchors to the wrong ancestor.
- Use DevTools to find and live-edit a fix for each bug, then copy the fixes into your stylesheet.
- Open responsive mode and confirm the page still looks correct at a mobile width.
Recap
Shows live HTML and every CSS rule affecting the selected element.
Displays real pixel values for content, padding, border, and margin.
Test CSS changes instantly before committing them to your file.
Test media query breakpoints at exact widths in the browser itself.
Key Takeaways
- Browser DevTools open with F12, Ctrl+Shift+I, or right-click → Inspect.
- The Elements panel pairs live HTML with the exact CSS rules affecting it, cascade order included.
- Struck-through rules in the Styles panel show which declarations lost a specificity conflict.
- Changes made in DevTools are temporary — copy confirmed fixes back into your actual stylesheet.
- Responsive mode lets you test any breakpoint's media queries without a second physical device.