Skip to content
EPUBCheck · XHTML content documents

EPUBCheck HTM_056: viewport missing a dimension

Updated:

EPUBCheck HTM_056 is an error message: “Viewport metadata has no "…" dimension (both "width" and "height" properties are required).” A fixed-layout viewport declares only one dimension, and both width and height are required. EPUBCheck names the dimension that is missing.

The official message

Viewport metadata has no "%1$s" dimension (both "width" and "height" properties are required)

Default severity
Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
EPUBCheck version
5.4.0

EPUBCheck prints this ID with an underscore instead of a hyphen; this page uses the ID exactly as EPUBCheck reports it.

%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.

Typical causes

  • A viewport with width but no height, or the reverse.
  • A viewport copied from a web page, such as width=device-width, initial-scale=1, which has no height.

How to fix it

  1. Open the file EPUBCheck names (the message gives the path, line and column) in a text or EPUB editor such as Sigil, or unzip the EPUB and open it there.
  2. Declare both in the first viewport meta element of the head, for example content="width=1200, height=1600".
  3. Use positive numbers in pixels, or device-width and device-height if the page should fill the screen.
  4. Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.

When it's not this

If both are present but one value is not a number, that is HTM_057; a parse error is HTM-047.

Terms used here

Other HTM messages

  • HTM_055 The "…" element should not be used (discouraged construct)
  • HTM_057 Viewport "…" value must be a positive number or the keyword "device-…"
  • HTM_054 Custom attribute namespace ("…") must not include the string "…" in its domain.
  • HTM_058 HTML documents must be encoded in UTF-8, but UTF-16 was detected.
  • HTM_059 Viewport "…" property must not be defined more than once, but found values […].
  • HTM_060b EPUB reading systems must ignore viewport meta elements in reflowable documents; viewport declaration "…" will be ignored.

Sources

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.

FAQ

What does EPUBCheck HTM_056 mean?

EPUBCheck HTM_056 is an error message: “Viewport metadata has no "…" dimension (both "width" and "height" properties are required).” A fixed-layout viewport declares only one dimension, and both width and height are required. EPUBCheck names the dimension that is missing.

Is HTM_056 an error?

HTM_056 is reported as error by default. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.