WordPress.org

Support

Support » Themes and Templates » [Resolved] Problem with centered images and links

[Resolved] Problem with centered images and links

  • Anna Johansson

    @vintagemaniac

    Using .aligncenter on a linked image only centers the image and not the link. I.e. the whitespace of the entire paragraph is linked, not just the image.

    You can see an example on it here.

    Using the ordinary .aligncenter {display:block;margin:0 auto} css.

    Any ideas on how to prevent this?

    update: It only seems to behave this way in FF though…

Viewing 2 replies - 1 through 2 (of 2 total)
  • chaoskaizer

    @chaoskaizer

    it need a fixed dimension so you must set the width prop for the linked image, update your theme’s style.css.

    find

    img.aligncenter {display: block; margin:1em auto; text-align:center}

    replace with

    img.aligncenter,.aligncenter {display: block; margin:1em auto; text-align:center}

    and apply the aligncenter class on link

    <a ... class="aligncenter" style="width:300px"><img ../></a>

    Anna Johansson

    @vintagemaniac

    Ah, so obvious now that you tell me…

    Big thank you for that! =)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Problem with centered images and links’ is closed to new replies.
Skip to toolbar