Skip to content
EPUBCheck · XHTML content documents

EPUBCheck HTM_057: invalid viewport value

Updated:

EPUBCheck HTM_057 is an error message: “Viewport "…" value must be a positive number or the keyword "device-…".” A viewport width or height is not a positive number or the matching device keyword. EPUB allows a plain positive number or device-width for width and device-height for height.

The official message

Viewport "%1$s" value must be a positive number or the keyword "device-%1$s"

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

  • Values with units, such as 1200px or 100%.
  • Zero, negative numbers or typos such as widht.
  • The wrong keyword for the dimension, such as height=device-width.

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. Use a plain positive number, for example width=1200, height=1600.
  3. Or use device-width for width and device-height for 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 a dimension is missing altogether, the message is HTM_056.

Terms used here

Other HTM messages

  • HTM_056 Viewport metadata has no "…" dimension (both "width" and "height" properties are required)
  • HTM_058 HTML documents must be encoded in UTF-8, but UTF-16 was detected.
  • HTM_055 The "…" element should not be used (discouraged construct)
  • HTM_059 Viewport "…" property must not be defined more than once, but found values […].
  • HTM_054 Custom attribute namespace ("…") must not include the string "…" in its domain.
  • 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_057 mean?

EPUBCheck HTM_057 is an error message: “Viewport "…" value must be a positive number or the keyword "device-…".” A viewport width or height is not a positive number or the matching device keyword. EPUB allows a plain positive number or device-width for width and device-height for height.

Is HTM_057 an error?

HTM_057 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.