# EPUBCheck HTM_057: invalid viewport value, how to fix it

Source: https://epubcc.com/epubcheck/htm_057/ (updated 2026-11-04)

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.

- Official message (EPUBCheck 5.4.0): Viewport "%1$s" value must be a positive number or the keyword "device-%1$s"
- Default severity: Error

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

## Sources

- EPUB 3.3, §8.2.2.6 Content document dimensions: https://www.w3.org/TR/epub-33/#sec-fxl-content-dimensions (read 2026-11-04)

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