Skip to main content

HTML Guide

Free site validation

Find out what web pages on your sites are affected by HTML issues.

CSS: “margin”: “"X"” is not a “margin” value.

The value specified for the margin CSS attribute is not valid, probably because it’s enclosed in quotes.

The margin CSS property defines the margin for the four sides of the element. There are several ways to specify this value, as in the following examples:

/* Apply to all four sides */
margin: 1em;
margin: -3px;

/* top and bottom | left and right */
margin: 5% auto;

/* top | left and right | bottom */
margin: 1em auto 2em;

/* top | right | bottom | left */
margin: 2px 1em 0 auto;

/* Global values */
margin: inherit;
margin: initial;
margin: revert;
margin: revert-layer;
margin: unset;

In all those cases the value does not need to be specified using quotes, so the following code may raise an issue:

  .marginalized {margin: "0 0 1em 0"}

In order to fix this issue you should remove the quotes, like in the following example:

  .marginalized {margin: 0 0 1em 0}

Learn more:

Related W3C validator issues