Sanjuktha
Sanjuktha

Reputation: 1085

How to change css style for only one image in specific page in wordpress?

For all the images by default the below style class is being set.

.figure {
    display: inline-block;
    vertical-align: top;
    position: relative;
    max-width: 100%;
}

I am trying to change display: inline-block to display:inherit only on a particular page. I added the image via visual composer in WP,and tried adding a new class for the image div by adding the style needed, but still the display:inline-block remained the same.Any solutions will be appreciated.Thanks.

Upvotes: 0

Views: 1098

Answers (2)

Alvin Pascoe
Alvin Pascoe

Reputation: 1209

If you've added a custom style to the figure (you mentioned a .pax class), then you simply need to specify the following in the CSS:

.figure.pax{
  display:inherit;
}

If that doesnt work, you can either add specificity to the selector (my preference) or add !important as follows:

.figure.pax{
  display:inherit !important;
}

(Alternatively, if you'd like the image to be display:block which is what it looks like you'd like, use display:block instead of display:inherit)

Upvotes: 0

Mitul
Mitul

Reputation: 3427

please add inline css and check its working or not?

If its working then add new class and add that class end of the css and try it will work

Like add inline-img this is the new class then add following css to end of your css file

.figure.inline-img{
 display:inherit;
} 

Upvotes: 1

Related Questions