View Single Post
Old 09-04-2013, 01:20 AM   #1
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 3,200
Karma: 34977896
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
Div Selectors vs Paragraph Classes -- Robustness?

I am trying this out ----
I'm using selectors in <div>s to format paragraphs, so that I don't have to use many styles for lots of paragraphs. This can keep all the styling in the div, and feels much simpler. I am only using this method for short segments.
For example, for some poetry that has altenating lines with deeper margins/indents:

Code:
CSS:
p { /*format for standard paragraph*/
margin: .25em 0;
text-indent: 1.5em;
}

div.stanza  {
margin: 1.5em 10%;
font-size: 90%;
}
div.stanza p {
text-align: left;
text-indent: -2em; 
}
div.stanza p,
div.stanza p+p+p,
div.stanza p+p+p+p+p,
div.stanza p+p+p+p+p+p+p {
margin-left: 2em;
}
div.stanza p+p,
div.stanza p+p+p+p,
div.stanza p+p+p+p+p+p,
div.stanza p+p+p+p+p+p+p+p {
margin-left: 4em; 
}

HTML:
<div class="stanza">
<p>And from our deck sad eyes looked out</p>
<p>Across the stormy scene:</p>
<p>The tossing wake of billows aft,</p>
<p>The bending forests green,</p>
<p>The chickens sheltered under carts</p>
<p>In lee of barn the cows,</p>
<p>The skurrying swine with straw in mouth,</p>
<p>The wild spray from our bows!</p>
</div>

Will this work in other situations, or did I just get lucky?
Is this as "robust" as using different classes for each type of paragraph?
Is it as widely compatible on different readers and apps?

Or, does it not matter which method I use?
GrannyGrump is offline   Reply With Quote