How to make the first paragraph in a webpage bold even if there is non paragraph content above it?

In article webpages I make the first paragraph bold this way:

article p:first-child {
    font-weight: bold;
}

My problem is that in some rare articles there is an image at the start of the article, just above the first paragraph, and in such cases, the above CSS doesn’t apply.
How to cover such paragraphs as well?

Try looking at :first-of-type :slight_smile: .
article p:first-of-type

2 Likes

Thanks. I actually tried it yesterday but didn’t see change and now I understand that the reason was an <img> wrapped inside a <p> so the <p><img></p> confused me and made the <p> under it look normal but now when I removed the <p> from the img this works fine.