HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

CSS Tutorial

CSS Introduction

What is CSSCSS SyntaxHow to Add CSSCSS Comments

CSS Foundations

Cascade & InheritanceCSS SpecificityCSS UnitsBox SizingCSS VariablesCSS Math Functions

CSS Selectors

CSS Element SelectorCSS Class SelectorCSS ID SelectorCSS Universal SelectorCSS Group SelectorCSS CombinatorsCSS Attribute SelectorsCSS Pseudo ClassesCSS Pseudo Elements

CSS Colors and Backgrounds

CSS ColorsCSS HEX ColorsCSS RGB ColorsModern ColorsCSS Background ColorCSS Background ImageLayered Backgrounds

CSS Text & Fonts

CSS Text ColorCSS Text AlignmentCSS Text DecorationCSS Font FamilyCSS Font SizeWeb Fonts & TypographyText Wrapping

CSS Box Model

CSS MarginCSS PaddingCSS BorderCSS OutlineCSS Width and Height

CSS Layout

Normal FlowCSS DisplayCSS PositionAnchor PositioningCSS FloatCSS OverflowCSS Z-indexIntrinsic SizingAspect Ratio & Object FitMulti-column Layout

CSS Flexbox

Flex ContainerFlex DirectionJustify ContentAlign ItemsFlex WrapFlex Item Sizing

CSS Grid

CSS Grid ContainerCSS Grid ColumnsCSS Grid RowsCSS Grid GapCSS Grid Layout ExampleGrid PlacementGrid AreasCSS Subgrid

CSS Lists, Tables & Forms

CSS ListsCSS TablesCSS Form StylingCSS Input Fields

CSS Effects

CSS ShadowsCSS GradientsCSS FiltersCSS OpacityClipping & MaskingBlending & BackdropScroll Snap

CSS Animations & Transitions

CSS TransformCSS 2D TransformCSS 3D TransformCSS TransitionsEntry & Exit TransitionsCSS AnimationsScroll AnimationsView TransitionsMotion Paths

CSS Responsive Design

CSS Media QueriesResponsive LayoutMobile First DesignContainer QueriesPreference Media QueriesFeature Queries

Modern CSS Authoring

Cascade LayersNesting & ScopeLogical PropertiesGenerated Content

CSS Accessibility

Accessible CSSCSS ThemingModern Form StylingCSS User Interface

CSS Output & Performance

Print StylesCSS PerformanceCSS ArchitectureDebugging CSS

CSS Reference

CSS At-rulesCSS FunctionsCSS Tutorial PDF

CSS Projects

Responsive CSS Project
  1. Home
  2. /
  3. Tutorials
  4. /
  5. CSS Tutorial
  6. /
  7. Debugging CSS

CSS Output & Performance

Debugging CSS

Trace computed values, layout constraints, stacking contexts, and overflow with browser developer tools. It provides a repeatable workflow for matched rules, computed values, box dimensions, Grid and Flex overlays, stacking contexts, overflow, and reduced test cases.

CSS debugging is the process of identifying the browser rule or layout constraint that produced a result. Developer tools expose that evidence directly.

Randomly changing declarations can hide the symptom while leaving the cause in place. Start with the affected element, inspect the winning and crossed-out rules, then check the computed value and layout model. Grid overlays, flex inspectors, stacking-context indicators, and accessibility panels narrow the problem further. This topic also connects with Cascade & Inheritance and CSS Specificity.

Inspect the element before editing the stylesheet

The Styles panel shows matched and overridden declarations. The Computed panel shows the final value and often links back to the rule that supplied it. Check pseudo-classes, inherited rules, layers, and invalid declarations.

Make invisible constraints visible

Example

css

/* Temporary diagnostic rule */
* {
  outline: 1px solid rgb(255 0 0 / 0.18);
}
  • Use the Grid and Flex overlays to see tracks, gaps, free space, and alignment.
  • Inspect the box model for unexpected padding, borders, or collapsed margins.
  • Look for min-width: auto when flex or grid content will not shrink.
  • Inspect stacking-context badges before raising z-index.
  • Use the Accessibility panel to check the computed name and contrast.
  • Emulate media features such as reduced motion and forced colors.

Reduce the case

Copy the smallest failing markup and styles into an isolated page. Remove declarations until the failure disappears, then restore the last relevant rule. A reduced case exposes interactions faster than random property changes.

Debugging Checklist

CheckWhat it revealsBrowser tool
Matched rulesWhich declarations matched and which were overridden.Styles panel
Computed valueThe final value after the cascade.Computed panel
Box dimensionsContent, padding, border, and margin sizes.Box model
Layout tracksFlex and Grid alignment and track boundaries.Layout overlay

Complete Example

Run the complete document below in the Try It editor. Resize the preview or interact with the controls where the example calls for it.

Complete runnable example

html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Debugging CSS example</title>
  <style>
    * { box-sizing: border-box; }
    body {
      margin: 0;
      padding: 2rem;
      font-family: system-ui, sans-serif;
      line-height: 1.5;
    }
    main { max-width: 70rem; margin-inline: auto; }
    article, section, aside, form, .card, .panel {
      padding: 1rem;
      border: 1px solid #cbd5e1;
      border-radius: 0.6rem;
    }

/* Temporary diagnostic rule */
* {
  outline: 1px solid rgb(255 0 0 / 0.18);
}
  </style>
</head>
<body>
  <main><section class="layout"><article><h1>Inspect this layout</h1><p>Open developer tools and inspect the box model, matched rules, and computed values.</p></article><aside>Sidebar</aside></section></main>
</body>
</html>

Browser Support

Feature
Chrome
Edge
Firefox
Safari
Core CSS inspection11211

Versions show the first stable desktop release with unprefixed support. Data source: MDN Browser Compatibility Data 8.0.8. A partial-support note is included where it changes how the example behaves.

Notes

  • A crossed-out declaration is not necessarily wrong; it may simply have lost the cascade. An unrecognized or invalid declaration is usually marked differently.
  • Test the example with real content, keyboard input, browser zoom, and the narrowest layout your project supports.
  • Use a fallback when the support table shows that one of your required browsers predates the feature.

Conclusion

Inspect the winning declaration and layout constraints before adding another override.

Once the responsible constraint is known, create the smallest fix at the same level: change the track, minimum size, containing block, or cascade relationship that caused the result. Reduce complicated failures to a small document before reporting a browser bug or adding a compatibility workaround.

PreviousCSS ArchitectureNextCSS At-rules