Skip to main content

HTML Guide

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

The border property in your CSS has too many values or uses incorrect values.

According to the CSS specification, the shorthand border property accepts the following, in any order: border-width, border-style, and border-color, but each should occur at most once and be a valid value.

Common mistakes:

  • Adding extra values, such as two widths or two colors.
  • Using an invalid border-style.
  • Misspelling keywords.

Correct syntax:

selector {
  border: border-width border-style border-color;
}
  • border-width: e.g., 1px, thin, 0
  • border-style: e.g., solid, dashed, none
  • border-color: e.g., #ff0, red, rgb(255,0,0)

Valid examples:

/* Valid shorthand: width, style, color */
div {
  border: 2px solid black;
}

p {
  border: thin dashed #00f;
}

section {
  border: 0 none;
}

Make sure your border property contains at most one valid value each for width, style, and color, and not more than three total.

Learn more:

Related W3C validator issues