Skip to content

CSS Missing Closing Brace

Quick summary

You forgot a closing } — the following rule's selector is treated as a property of the broken rule and both are ignored.

Why this happens

  • Deleted a } while editing but left the opening {

  • Nested selectors in preprocessors without matching braces

  • Copy-paste that dropped the closing brace

Minimal example

✗ Broken code
.card {
  padding: 16px;
  /* missing } */
.button {
  color: blue;
}
✓ Fixed code
.card {
  padding: 16px;
}
.button {
  color: blue;
}

Without the closing } for .card, the .button selector is parsed as a property of .card and both rules break. Adding the brace separates them correctly.

How to diagnose

  • Inspect DevTools — affected rules are missing entirely

  • Run stylelint which reports unclosed braces

  • Use editor brace matching to find the unbalanced }

How to fix

  • Add the missing } at the end of the rule

  • Re-indent the CSS so block structure is visible

  • Use a formatter that enforces brace balance

How to prevent

  • Use a CSS linter/formatter on save

  • Enable editor auto-closing for braces

Related Resources

Related Glossary

Related Lessons

  • CSS

    Learn about CSS syntax.

← Back to language