Reputation:
I am trying to display the first letter of the first paragraph within the article element with a font size of 2em and vertically aligned with the baseline of the surrounding text. This is my code so far:
article p ::first-letter:first-of-type {
font-size: 2em;
vertical-align: baseline;
}
It didn't have the desired results. Maybe someone could advise please how i may fix my code to achieve that goal?
Upvotes: 0
Views: 159
Reputation: 6912
Just reverse the pseudo class and the pseudo element, and remove the space character (that serves as descendant combinator):
article p:first-of-type::first-letter
Upvotes: 0
Reputation: 943591
Such:
article p:first-of-type::first-letter {
font-size: 2em;
vertical-align: baseline;
}
<article>
<h1>Example</h1>
<p>The quick brown fox</p>
<p>The quick brown fox</p>
<p>The quick brown fox</p>
</article>
<article>
<h1>Example</h1>
<p>The quick brown fox</p>
<p>The quick brown fox</p>
<p>The quick brown fox</p>
</article>
Upvotes: 1