Skip to main content

HTML Guide

CSS: “margin”: Too many values or values are not recognized.

The value specified for a margin attribute in CSS is not valid.

The margin CSS property sets sets the margin area on all four sides of an element. There are many allowed values for this attribute, for example:

/* 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;

Learn more:

Related W3C validator issues