View Single Post
Old 08-05-2013, 12:42 PM   #8
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: 7,556
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Leonatus View Post
This is what I have, more or less. The point is that, linking my css to the html text, all paragraphs are formatted as "p". When there is a poem in the text, due to the line breaks, every line is separately formatted as "p", and I had to change, line by line, into ".p1" paragraph class, where I have my poem "specifics".
What mzmm means is that you could change the CSS, so that instead of ".p1" you have "div.poetry p". That way you don't have to apply any specific style to poetry lines, as long as they are enclosed in a "<div class="poetry">" block, as the "div.poetry p" selector applies to any <p> inside such a block, with or without class.

Quote:
Originally Posted by DaleDe View Post
For poetry I tend to make a full stanza into one paragraph. I use <br /> for line breaks within the paragraph. This minimizes the need to adjust a large number of paragraphs. But it also minimizes the control you have over formatting but for me it works fine for the occasional poem or lyric in a prose document.
Sure, the whole point of wrapping each line in a block element is allowing nice linebreaks by using negative text-indents, otherwise I guess you can get pretty much the same result with just <br>.

By the way, I wouldn't recommend using <p> for poetry lines because they are in fact not paragraphs. One could argue that stanzas are sort of paragraphs, but not lines. I'd use <div> or <span> (with display:block). The latter is closer to the real semantics, the former has the advantage of displaying nicely even with CSS disabled (and the disadvantage that you cannot use <p> for stanzas with that). My usual setup:

Code:
<div class="poetry">
  <div class="stanza">
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
  </div>
  <div class="stanza">
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
    <div class="line">verse line</div>
    <div class="line2">verse line</div>
  </div>
</div>
("line" and "line2" have different left margins, to create the desired indent patterns, when needed.)

A bit too verbose, and one could dispose of the class="line" through CSS, but it's usually quite easy to apply this formatting to all kinds of poetry fragments.
Jellby is offline   Reply With Quote