Missing Semicolon in CSS
Every CSS declaration must end with a semicolon. When you forget one, the browser tries to parse the next line as part of the current value. This usually breaks both the current declaration AND the next one.
Why It Matters
A missing semicolon is the most common CSS syntax error. It silently breaks two rules at once: the one missing the semicolon and the one after it. This makes it especially confusing because the rule that appears broken isn't the one with the actual error.
Common Causes
- Hand-writing declarations and forgetting the semicolon, most often on the last property in a block.
- Reordering or pasting lines so a value runs straight into the next property name.
- Editing minified or single-line CSS where the missing separator is hard to see.
Code Examples
.card {
background: #fff /* missing semicolon */
border-radius: 8px;
padding: 20px;
color: #333 /* missing semicolon */
font-size: 14px;
}.card {
background: #fff;
border-radius: 8px;
padding: 20px;
color: #333;
font-size: 14px;
}How to Fix
- 1Always end every CSS declaration with a semicolon, including the last one in a block.
- 2When a CSS rule doesn't work, check the line ABOVE it for a missing semicolon.
- 3Use a CSS validator to catch missing semicolons automatically.
- 4Configure your editor to auto-insert semicolons (Prettier, stylelint).
Frequently Asked Questions
Do I really need a semicolon after the last declaration?
Why does the rule below the missing semicolon also break?
How do I find a missing semicolon fast?
Check Your CSS Now
Our CSS validator detects this error automatically and shows the exact line number.
Open CSS ValidatorCloudways · Managed Cloud Hosting
Fix this CSS error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).
Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303
Related CSS Errors
Unclosed CSS Bracket
An unclosed curly brace can break your entire stylesheet at once. Learn how a missing closing bracket cascades, and how to locate and fix it quickly.
Invalid CSS Property Value
Learn why an invalid CSS property value silently breaks your styling, and how to fix the common color, unit, keyword, and function mistakes quickly.
Empty CSS Rule
Empty CSS rules add bytes and clutter without doing anything useful. Learn why they appear, how to find unused selectors, and how to clean them up now.