Quote:
Originally Posted by DNSB
One problem with using that solution is that it does not seem to allow using <p class="noindent"> to not indent a single paragraph. I've attached a sample image from calibre's ebook-viewer where the last two paragraphs should not have an indent.
|
That was just an example for the specific code shared by the OP. But to address your case either, you can just ADD my suggestion to the original CSS:
Code:
p {
text-indent: 2em;
}
.noindent {
text-indent: 0em;
}
.noindent p {
text-indent: 0em
}
See that a more specific rule takes precedence over the general one.
In other cases, you might need to apply it to everything but a specific class (let's call it 'special'); then you could declare it like this:
Code:
.noindent p:not(.special) {
text-indent: 0em
}
If you want just the first instance of <p> to have that style, then use the '+' sign. This is good for styling first paragraphs without using classes, or for a drop cap (alongside with pseudo-selector 'first-letter'):
Code:
h1 + p {
text-indent: 0em
}