Skip to main content

Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #262209
    vulkanus
    Participant

    Hi,

    I have an image inside a paragraph p, and I do not intend to add code inside the function.php on WP to remove the wpautop filter.
    Also is not working adding p img {margin: 0;} on css
    Is there any way to force the image removes the space top and bottom that image have?

    Thanks in advance.

    #262210
    Shikkediel
    Participant

    I would think it is the p element that needs the margin reset…

    https://www.w3schools.com/cssref/css_default_values.asp

    #262211
    vulkanus
    Participant

    Shikkediel,

    tks for reply,

    I understand that, but doing that, will remove all margins from p, and I don´t want that.
    I must target the <img without affect the parent element, I don´t know if existe any constructor selector to do that.

    #262213
    Shikkediel
    Participant

    As far as I can tell, you’d still have to target the parent because that has the margin. There isn’t a CSS selector I am aware of to only address elements that contain a certain other element.

    If you’d like to specifically target p elements that contain an img, you’d have to use JavaScript.

    #262214
    vulkanus
    Participant

    Shikkediel,

    I think that you are right.
    Maybe only with JS, but I have put a div without any class inside and automatically have removed the space.

    Thank you.

    #262215
    Shikkediel
    Participant

    I might not be familiar enough with WP to comprehend the mechanism you describe…

    But if it works, then who’s complaining. :-)

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.