Archived topic
Margin on aligncenter images
5 replies · Started by Tobias Hjorth on May 26, 2015
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/
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 :)
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?
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;
}
Thanks a million Tom that worked like a charm! :)
Awesome :)
