Skip to main content
HTML Validation

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

About This HTML Issue

The height property in your CSS containing invalid or too many values. The height property should have only one valid length, percentage, or keyword value.

Valid Values for height Property:

  1. Length values: px, em, rem, etc. (e.g., 100px, 10em)
  2. Percentage values: (e.g., 50%)
  3. Keyword values: auto, max-content, min-content, fit-content, inherit, initial, unset

Example of Incorrect Usage:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    .example {
      height: 100px 50px; /* Incorrect: Too many values */
    }
  </style>
  <title>Height Property Example</title>
</head>
<body>
  <div class="example">Content</div>
</body>
</html>

Example of Correct Usage:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    .example {
      height: 100px; /* Correct: One valid value */
    }
  </style>
  <title>Height Property Example</title>
</head>
<body>
  <div class="example">Content</div>
</body>
</html>

Last reviewed: September 23, 2024

Was this guide helpful?

Find issues like this automatically

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

Ready to validate your sites?
Start your free trial today.