Skip to main content
HTML Validation

Bad value “auto” for attribute “height” on element “video”: Expected a digit but saw “a” instead.

About This HTML Issue

The height attribute on the <video> element must be a non-negative integer representing the height in CSS pixels. The value “auto” is not a valid value for this attribute. To resolve the issue, set the height attribute to a specific numeric value or adjust the height using CSS instead.

Example with a numeric height value:

<video width="640" height="360" controls>
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

Alternatively, control the height using CSS:

<video width="640" controls style="height: auto;">
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

In the CSS approach, “auto” can be used, but it should not be part of the HTML attributes.

Last reviewed: April 04, 2025

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.