Is there an equivalent for the psuedo-class, first-of-type, but applies to, e.g., a <p> preceded by a <hr>, rather than just applying to the first child-tag?
As an example, I'd like first-of-type to apply to both paragraphs preceded by <h1>, rather than just the first:
<head>
<style>
p{text-indent:1%;}
p:first-of-type{text-indent:0%;}
</style>
<title>Mara's Tale</title>
</head>
<body>
<h1>Chapter 1</h1>
<p>This is a first-of-type.</p>
<p>But this isn't (good!).</p>
<h1>Chapter 2</h1>
<p>This is not first-of-type, but I'd like it to be.</p>
<p>This is not first-of-type (good!).</p>
</body>
</html>
At the moment, I'm running a regex to add a class to any <p> not preceded by </p>, but, as a solution, it irks me.
Update to add:
Heh - for some reason, this confused the hell out of my Sony e-reader*, which then started ignoring a valid first-of-type.
I had to change this CSS:
p:first-of-type{
text-indent: 0%;
}
p.dinkus {
text-align: center;
text-indent: 0%;
font-size: 125%;
margin-top: 6%;
margin-bottom: 4%;
white-space: pre;
}
p.dinkus + p{
text-indent: 0%;
}
To this:
h1 + p{
text-indent: 0%;
}
p.dinkus {
text-align: center;
text-indent: 0%;
font-size: 125%;
margin-top: 6%;
margin-bottom: 4%;
white-space: pre;
}
p.dinkus + p{
text-indent: 0%;
}
Just to clarify, my general structure is:
<h1>Chapter 3</h1>
<p>Opening para - don't indent.</p>
<p>Non-opening para - do indent.</p>
<p class="dinkus">* * *</p>
<p>Para following a dinkus - don't indent.</p>
<p>Non-opening para, not following a dinkus - do indent.</p>
* seems to be a Sony bug - Sigle and Calibre had no issues