A
A
Andrey2016-04-05 12:04:04
css
Andrey, 2016-04-05 12:04:04

Add css style to first image inside wordpress post?

There are many images in the post, all of them are displayed in full size. Unfortunately, all the images inside the post have the same css, and I only need to change the size and style (using css) of the first image in the post.
Can you please tell me if it is possible to add a certain css style (for example, first-image) for the first image inside the post through function.php or in some other way.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2016-04-05
@dyba

Nikita Ignatiev , thanks for the first-child hint :)
The solution turned out to be the following:
.entry-single p:first-child img {}

N
Nikita, 2016-04-05
@Nivalis

Perhaps the most time-consuming is to add a class for the desired picture in the post editor. And then in css change the styles of the class.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question