Skip to main content
HTML Validation

Bad value X” for attribute “height” on element “embed”: Expected a digit but saw “p” instead.

About This HTML Issue

Remove the unit; height on embed expects a non-negative integer (pixels) or a valid CSS length only when set via CSS, not the HTML attribute.

Detailed explanation

The embed element supports the presentational attributes width and height as unsigned integers representing CSS pixels. In HTML, the height attribute must be a number without a unit, for example 650. Supplying 650px violates the attribute’s value syntax and triggers the validator error.

If you want to use units or other CSS lengths (e.g., px, em, %, vh), set them with CSS via the style attribute or a stylesheet using the height property, not the HTML attribute.

HTML examples

Example reproducing the issue

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Embed height invalid</title>
</head>
<body>
  <embed src="file.pdf" type="application/pdf" width="800" height="650px">
</body>
</html>

Corrected example (HTML attribute as integer)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Embed height fixed</title>
</head>
<body>
  <embed src="file.pdf" type="application/pdf" width="800" height="650">
</body>
</html>

Alternative corrected example (use CSS units)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Embed height via CSS</title>
  <style>
    .viewer { width: 800px; height: 650px; }
  </style>
</head>
<body>
  <embed class="viewer" src="file.pdf" type="application/pdf">
</body>
</html>

Last reviewed: August 11, 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.