datasn.io
datasn.io

Reputation: 12877

CSS3 to target first text letter of first X element?

I'm currently using this selector:

.entry > p:first-of-type:first-letter {
}

To do a drop cap for the first letter of the first P element under .entry.

It works fine on this page, but not this one. The problem with the latter one is probably because there's an <a> element proceeding all the text content inside the first P element.

So my question is how to work around this? How to target the first text letter of the first X element rather than just the first letter?

Thanks!

Upvotes: 0

Views: 103

Answers (1)

Raleigh Buckner
Raleigh Buckner

Reputation: 8393

The problem with your second page is that the first <p> has nothing but an image in it. Your text doesn't start until the second <p>.

If you remove the <p> around the image, then the text "At $499.." will be in the first <p> and the letter "A" will match the CSS selector you have.

Upvotes: 1

Related Questions