Forums

Give help. Get help.

  • # November 4, 2017 at 1:14 pm

    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.

    # November 4, 2017 at 1:48 pm

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

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

    # November 4, 2017 at 2:09 pm

    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.

    # November 4, 2017 at 2:39 pm

    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.

    # November 4, 2017 at 2:52 pm

    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.

    # November 4, 2017 at 3:06 pm

    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)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag