View Single Post
Old 05-09-2009, 09:52 AM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,958
Karma: 4346919
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
poetry fragments

Novels often have fragments of poetry or songs interspersed in them. As we all know, poetry has some formatting requirements (hard line breaks) and some display customs (centered or indented block).

I use code like the following when I have to format poetry fragments in a text. I use individual <p></p> for each line instead of just <br/> because I want to use the effect of the negative parindent: when a line is too long to fit the screen, it is "soft-broken" and the second portion is indented farther to the right (actually, I'd like it to be left-aligned and preceded by "[", but I don't think that's possible)

xhtml:
Code:
<div class="poetry">
<p>Sur une gamme chromatique,</p>
<p class="indented">Le sein de perles ruisselant,</p>
<p>La Vénus de l’Adriatique</p>
<p class="indented">Sort de l’eau son corps rose et blanc.</p>

<p class="first">Les dômes, sur l’azur des ondes</p>
<p class="indented">Suivant la phrase au pur contour,</p>
<p>S’enflent comme des gorges rondes</p>
<p class="indented">Que soulève un soupir d’amour.</p>

<p class="first">L’esquif aborde et me dépose,</p>
<p class="indented">Jetant son amarre au pilier,</p>
<p>Devant une façade rose,</p>
<p class="indented">Sur le marbre d’un escalier.</p>
</div>
css:
Code:
div.poetry {
  margin: 1em 0 1em 2em;
}
div.poetry p {
  margin: 0;
  padding-left: 3em;
  text-indent: -3em;
  text-align: left;
}
div.poetry p.indented {
  margin-left: 2em;
}
div.poetry p.first {
  margin-top: 1em;
}
So, use class="first" when a new stanza begins and class="indented" for indented lines.

For pieces with more complex indent pattern or for mainly poetry works I'd probably do something different, like a <div></div> for each stanza (which could include "page-break-inside: avoid" in the css).

Last edited by Jellby; 05-09-2009 at 01:22 PM.
Jellby is online now   Reply With Quote