I'm currently grappling with how to specify that a 'first-of-type' should only be present on specific instances of a div. For instance, suppose I have a class called ".maintext" and in some cases I want the first paragraph to feature a dropcap while in others I do not.
Typically, I use the following approach:
.maintext { font, border, etc }
.maintext p:first-of-type:first-letter { css for the dropcap }
However, this results in every <div class='maintext'>
triggering the appearance of the dropcap. How can I signify in the HTML when I want the dropcap to appear and when I don't, so as to adhere to DRY principles?
My standard HTML structure for this scenario is as follows:
<div class="maintext>
<p>some text</p>
<p>some text</p>
</div>