Skip to content
EPUBCheck · Stylesheets

EPUBCheck CSS-008: syntax error in a CSS file

Updated:

EPUBCheck CSS-008 is an error message: “An error occurred while parsing the CSS: ….” The CSS parser found a syntax error in a stylesheet or style element. EPUBCheck reports the parser's own description and the line and column, and rules after the error may be skipped by reading apps.

The official message

An error occurred while parsing the CSS: %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

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

Typical causes

  • A missing semicolon or brace, or a stray character.
  • Invalid syntax copied from a preprocessor such as Sass or Less, or from a stylesheet that was cut off.
  • A comment that was not closed.

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. Go to the line and column in the message and correct the syntax there.
  3. Check the rule just before that position as well: a missing brace is often reported further down.
  4. Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.

When it's not this

If the CSS parses but uses a property EPUB forbids, that is CSS-001.

Terms used here

Other CSS messages

  • CSS-007 Font-face reference "…" refers to non-standard font type "…".
  • CSS-006 CSS selector specifies fixed position.
  • CSS-005 Conflicting alternate style tags found: ….
  • CSS-004 CSS documents must be encoded in UTF-8, detected …;
  • CSS-003 CSS document is encoded in UTF-16. It should be encoded in UTF-8 instead.
  • CSS-002 Empty or NULL reference found.

Sources

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

FAQ

What does EPUBCheck CSS-008 mean?

EPUBCheck CSS-008 is an error message: “An error occurred while parsing the CSS: ….” The CSS parser found a syntax error in a stylesheet or style element. EPUBCheck reports the parser's own description and the line and column, and rules after the error may be skipped by reading apps.

Is CSS-008 an error?

CSS-008 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.