Skip to main content
HTML Validation

CSS: “margin-bottom”: X is not a “margin-bottom” value.

About This HTML Issue

An invalid value was assigned to the margin-bottom CSS property, and the W3C validator rejected it because it does not match any accepted syntax for that property.

The margin-bottom property accepts a length (e.g., 10px, 2em), a percentage (e.g., 5%), auto, or the global keywords inherit, initial, revert, and unset. The validator raises this error when the value is misspelled, uses a wrong unit, is missing a unit entirely, or contains an otherwise unrecognized token.

Common causes:

  • A bare number without a unit, like margin-bottom: 10 instead of margin-bottom: 10px. Zero is the only length value that does not require a unit.
  • A typo in the unit or keyword, like margin-bottom: 10 px (with a space) or margin-bottom: auто (mixed character encodings).
  • An invalid keyword, like margin-bottom: none. The margin-bottom property does not accept none.

Example with the error

<p style="margin-bottom: 10">This paragraph has an invalid margin.</p>

The value 10 is not valid because it lacks a unit.

Fixed example

<p style="margin-bottom: 10px">This paragraph has a valid margin.</p>

Adding a recognized unit like px, em, rem, or % fixes the error. If the intended value is zero, margin-bottom: 0 is valid without a unit.

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries