Answers.Body: <p>I posted an issue at the epubcheck site.</p>
  
  <p>Someone there knew right away what the problem was.</p>
  
  <p>This is acceptable:</p>
  
  <pre><code>&lt;p&gt;Text &lt;span class="red"&gt;red&lt;/span&gt; regular.&lt;/p&gt;
  </code></pre>
  
  <p>This is acceptable:</p>
  
  <pre><code>&lt;p&gt;Text &lt;span style="color:red"&gt;red&lt;/span&gt; regular.&lt;/p&gt;
  </code></pre>
  
  <p>This is <strong>not</strong> acceptable, and is what I had:</p>
  
  <pre><code>&lt;p&gt;Text &lt;span style="red"&gt;red&lt;/span&gt; regular.&lt;/p&gt;
  </code></pre>
  
  <p>It was hard for me to figure out because the character position reported by epubcheck was at the beginning of the paragraph, far away from the actual error.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-23T04:33:37.537Z
Answers.Text: you mean you changed `class` to `style` don't you?
Answers.UserDisplayName: Anthon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-26T14:25:20.963Z
Answers.Text: No, he means `style="red"` is, indeed, invalid, but `class="red"` is not. However, I don't see any problems in his original post, because there isn't any place that it should have been parsing CSS.
Answers.UserDisplayName: Auspex
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-31T13:01:15.727Z
Answers.Text: `<span class="red">` Whenever I make classes I make sure the class name is not the same as any keyword, to reduce confusion. So I would call the style 'redclass' or something like that.
Answers.UserDisplayName: Bulrush
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-22T18:27:50.670Z
Answers.LastActivityDate: 2016-02-28T13:13:28.963Z
Answers.LastEditDate: 2016-02-28T13:13:28.963Z
Answers.UserDisplayName: Paulb
Answers.Body: <blockquote>
    <p>&lt;p class="flush"&gt;"Time flies &lt;span style="red"&gt;</p>
  </blockquote>
  
  <p>"red" is not a valid CSS style. The style should be <code>&lt;span style="color:red;"&gt;</code></p>
  
  <p>This also works: <code>&lt;span style="color:red; font-weight:bold;"&gt;</code></p>
  
  <p>But in an epub, which uses XHTML, I always used classes. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-31T12:54:55.947Z
Answers.LastActivityDate: 2016-05-31T12:54:55.947Z
Answers.UserDisplayName: Bulrush
Body: <p>Epubcheck reports an error for a paragraph like:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
    &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
       &lt;meta content="text/html; charset=utf-8" http-equiv="content-type" /&gt;
       &lt;title&gt;Title&lt;/title&gt;
       &lt;link rel="stylesheet" type="text/css" href="foo.css" /&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;p class="flush"&gt;"Time flies &lt;span style="red"&gt;when&lt;/span&gt; you're having a good time"&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The error comes back as:</p>
  
  <pre><code>Position 1
  An error occurred while parsing the CSS: Premature end of grammar (expecting: :).
  </code></pre>
  
  <p>There are no other errors in the EPUB.</p>
  
  <p>I don't know how to fix this error.  It's the first time I've encountered it. </p>
  
  <p>Worthy of note: this same epub file runs through Amazon Kindlegen with no errors.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-26T14:28:44.950Z
Comments.Text: You appear to be citing the wrong piece of code, as epubcheck shouldn't be parsing CSS in this file (your only CSS is in the `<link >` reference, and that's going to be handled separately).
Comments.UserDisplayName: Auspex
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-26T15:42:29.083Z
Comments.Text: I edited my answer below to clarify.
Comments.UserDisplayName: Paulb
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-27T22:49:44.900Z
Comments.Text: Actually the answer was clear. But you edited this question, too, because there were no style attributes in your original post.
Comments.UserDisplayName: Auspex
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-28T13:18:49.260Z
Comments.Text: I know. The question was confusing, because as I asked it originally it was very different from what the eventual problem turned out to be. With new knowledge of what the problem really was I edited it for clarity.
Comments.UserDisplayName: Paulb
Tags: <epub><validation><epubcheck>
Title: CSS error in EPUB
UserDisplayName: Paulb
ThreadText: # CSS error in EPUB
  
  (Asked by: username_0 on 2016-02-22)
  
  Epubcheck reports an error for a paragraph like:
  
  ```
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
       <meta content="text/html; charset=utf-8" http-equiv="content-type" />
       <title>Title</title>
       <link rel="stylesheet" type="text/css" href="foo.css" />
    </head>
    <body>
        <p class="flush">"Time flies <span style="red">when</span> you're having a good time"</p>
    </body>
  </html>
  
  ```
  
  The error comes back as:
  
  ```
  Position 1
  An error occurred while parsing the CSS: Premature end of grammar (expecting: :).
  
  ```
  
  There are no other errors in the EPUB.
  
  I don't know how to fix this error. It's the first time I've encountered it.
  
  Worthy of note: this same epub file runs through Amazon Kindlegen with no errors.
  
  **Tags:** epub, validation, epubcheck
  
  > **Comments:**
  > **username_1**: You appear to be citing the wrong piece of code, as epubcheck shouldn't be parsing CSS in this file (your only CSS is in the `<link >` reference, and that's going to be handled separately).  
  > **username_0**: I edited my answer below to clarify.  
  > **username_1**: Actually the answer was clear. But you edited this question, too, because there were no style attributes in your original post.  
  > **username_0**: I know. The question was confusing, because as I asked it originally it was very different from what the eventual problem turned out to be. With new knowledge of what the problem really was I edited it for clarity.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-02-22. Score: 1
  
  I posted an issue at the epubcheck site.
  
  Someone there knew right away what the problem was.
  
  This is acceptable:
  
  ```
  <p>Text <span class="red">red</span> regular.</p>
  
  ```
  
  This is acceptable:
  
  ```
  <p>Text <span style="color:red">red</span> regular.</p>
  
  ```
  
  This is **not** acceptable, and is what I had:
  
  ```
  <p>Text <span style="red">red</span> regular.</p>
  
  ```
  
  It was hard for me to figure out because the character position reported by epubcheck was at the beginning of the paragraph, far away from the actual error.
  
  > **Comments:**
  > **username_2**: you mean you changed `class` to `style` don't you?  
  > **username_1**: No, he means `style="red"` is, indeed, invalid, but `class="red"` is not. However, I don't see any problems in his original post, because there isn't any place that it should have been parsing CSS.  
  > **username_3**: `<span class="red">` Whenever I make classes I make sure the class name is not the same as any keyword, to reduce confusion. So I would call the style 'redclass' or something like that.  
  
  ---
  
  ### Answer by username_3 on 2016-05-31. Score: 0
  
  > <p class="flush">"Time flies <span style="red">
  
  "red" is not a valid CSS style. The style should be `<span style="color:red;">`
  
  This also works: `<span style="color:red; font-weight:bold;">`
  
  But in an epub, which uses XHTML, I always used classes.
  
  
  ---
  
  