FelipeBrubeck
FelipeBrubeck

Reputation: 45

Formatting in HTML vs CSS in epub

I've been looking around a little and haven't found an answer to this question. I am making an epub book and I've no idea what is the most adequate practice, if style italic, bold or underlined text in the html file, using <i>, <b> and <u> tags or define this in a class in the styles sheet. Can somebody clarify this to me, please?

Upvotes: 1

Views: 670

Answers (2)

Steve Harris
Steve Harris

Reputation: 5109

I think whichever is used, it should be consistent. Remember you can override the effect an <i> tag will have by adding appropriate CSS. If you decide later on that everything italic should also be red, you only want to change that in one place.

Upvotes: 0

William Callahan
William Callahan

Reputation: 639

It depends on the situation. For example, in a paragraph, if the developer only wishes to make some text italic, then there is no reason to create a class for it. However, if there is a specific case where text must have a format while inside of a specific tag structure, this is when you should create a class.

Use a CSS Class

<div id="important">
    <p>This should always be italic under this condition</p>
    <p>And so should this</p>
</div>
<div>
    <p>But this should not</p>
</div>
<div>
    <p>And maybe I want to have multiple styles at once. <span class="underline-bold-italic">Use a class</span></p>
</div>

Use A Tag

<p>Hmmm... <i>this</i> may be important.</p>

Upvotes: 1

Related Questions