[Resolved] Margin on aligncenter images

Home Forums Support [Resolved] Margin on aligncenter images

Home Forums Support Margin on aligncenter images

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #110431
    Tobias Hjorth

    Hi all

    Is there’s some way to reducing margin on .aligncenter both on left and right. No mater what I do I can only add margin on the left. The right margin gets ignored even when using !important.

    I Would like to have .aligncenter images with pixel on each side but it seems as .aligncenter follows the Width on the content. I’m surely missing something but I can’t figure out what..

    Example on marginleft only:
    http://www.tobiashjorth.com/sigma-120-300mm-f2-8-dg-os-hsm-s-review/

    #110500
    Tom
    Lead Developer
    Lead Developer

    Try wrapping your image in a div, and then apply the negative margin to the div.

    For example:

    <div style="margin: 0 -15px;"><img src="..." /></div>

    That should work better πŸ™‚

    #110534
    Tobias Hjorth

    Thanks Tom, I can’t thank you enough on how quick and kind you are to answer my questions (and others) –
    Besides this awesome theme your support is second to none!

    Is this div something I’m able to assign in the child css (the easiest for me) or do I need to go and change it on a single post basis?

    #110704
    Tom
    Lead Developer
    Lead Developer

    It’s a little hacky, but since you have an anchor wrapping around the image with a specific rel for the lightbox, you can do this:

    a[rel="lightbox-2"] {
        display: block;
        margin: 0 -15px;
    }
    #110876
    Tobias Hjorth

    Thanks a million Tom that worked like a charm! πŸ™‚

    #110967
    Tom
    Lead Developer
    Lead Developer

    Awesome πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.