4

I'm working on my first epub, and I would like to use the following CSS scheme:

  1. Most paragraph tags would have no class assigned and would be styled by a simple rule in the style sheet...

    p {}
    
  2. A special series of paragraph tags would have a different style. However, I would put these paragraphs inside div's, so the style would just look something like this:

    div.footnote p { margin: 2px 15px; indent: 0; }
    
  3. Any remaining paragraphs that require special styling would be assigned classes. They would be the only paragraph tags with classes.

Is this scheme OK, or is there a special reason I should give every paragraph tag a class? I'm asking because I think I remember a comment about this on some tutorial that I can't locate right now. I just want to make sure I'm not making a major gaffe by creating an epub with empty tags.

2 Answers 2

2

There is no need to give every paragraph a class, the definition at 1. will apply to every paragraph, with or without a tag, and only on paragraphs that are directly below a footnote the settings will be overruled by those of the CSS of 2.

You might not even need to have the CSS at 1., but for the defaults of the ePub reader.

0

As Anthon says, there is no need to apply a class to every paragraph, if that paragraph don't need to be styled in a particular way, different from the others.

It is perfectly acceptable to have, in example, <p>This is a simple paragraph without an associated style</p>.

This is a bit beyond the scope of your question, but it is related to "default" text and could be handy to know: if you need to define a default style for all your text (<p>, <div>, <h1>... you got the point), you can define the custom styling to apply to the html <body> tag, in example

body {
    font-family: arial, helvetica, sans-serif;
    text-align: justify;
    font-size: 1.2em;   
}

it will set the base style of the text, when not given a different one with more specific tags.

Again, this is not required, most of the times you won't need to set this at all. You should only define it if you don't want your text to use the default settings of the e-reader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.