CSS newbie for ebooks

Soldato
Joined
28 Dec 2003
Posts
3,769
Location
Aberwristwatch
Trying to highlight a piece of text as italic for an epub document (for reading on a Sony Reader)

<p class="p_normal">Wedi i mi ddarllen</p>
<p class="p_normal">Annwyl Non</p>​
This is the code generated and here is the style.css document

.center { text-align: center; text-indent: 0em; }
.right { text-align: right; }
.toc_heading { text-align: center; margin-top: 20pt; margin-bottom: 20pt; }
.p_normal {text-indent: 10mm; margin-top: 5pt; margin-bottom: 5pt;}
.p_toc { text-indent: 10mm; margin-top: 10pt; margin-bottom: 10pt;}​

As no italic style exists, should the following work? Adding

.p_normal_italic {font-weight: bold; text-indent: 10mm; margin-top: 5pt; margin-bottom: 5pt;}​

to the style sheet and amending the text in the html document to

<p class="p_normal_italic">Annwyl Non</p>
 
Hi

You need a "font-style: italic;" inside the .p_normal_italic style. At the moment its just bolded.

oh its for ebooks... doh just use <i> tags?
 
Can you not just wrap it in an <i> </i> tag?

IMHO it is best to use an <em></em> (emphasis) tag rather than an italic tag. In most user-agents, the content will be italicised, but it is up to each UA to choose.

It may be less of an issue for eBooks but IMHO it is good practice anyway.

Edit: Actually, I'm certain that <em> should be used. If the ebook is 'read' through a screenreader (people with visual impairments are big ebook consumers) or similar device, the screenreader will say "italic MyWord close-italic" for an <i> tag and "MyWord" but with the word emphasised or stressed for the <em> tag - which is precisely what the author intends. It's the separation of presentation from structure...
 
Last edited:
Back
Top Bottom