• Hi guys,

    I’m looking for some CSS code that will center all of my images inside of posts (I imported a WordPress.com site and have around 240 posts so it’d be nice not to have to do it manually for each one).

    Also, for vertical images that are centered, it’d be nice if the caption moved so that it stays underneath the image as well.

    I had some CSS in place that did all of this on my old site and it doesn’t seem to work on my new one. My site is https://www.exploringtherockies.com.

    Thanks in advance for the help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,
    All the pictures in this post seem to be already centered. Am I wrong?
    https://www.exploringtherockies.com/2013/10/29/iceland-land-of-wind-stone-fire-ice/

    Thanks.

    Thread Starter benconners

    (@benconners)

    Hi!

    The horizontal photos appear centered just because they’re set to spread across the entire body area of the site, what I’m really after are for the vertical photos/captions to be centered in the body area instead of left aligned…

    Hello,
    I am not sure how to do this for all posts. I would just go through and start center aligning them. I don’t think there is a way to do that for all posts.

    Thanks.

    Thread Starter benconners

    (@benconners)

    I was able to do it using custom CSS at WordPress.com. The CSS looked like this

    #content img {
    display: block;
    margin-left: auto;
    margin-right: auto;
    }

    .alignleft, #content img.alignleft, .hentry img.align.left {
    margin-right: 20px;
    }

    .alignright, #content img.alignright, .hentry img.align.right {
    margin-left: 20px;
    }

    Hello,
    I was afraid to give you that kind of solution in case you wanted a few images not to be centered. Glad you got it sorted anyway. ??

    Thanks.

    Thread Starter benconners

    (@benconners)

    Well that’s my problem unfortunately, the above CSS doesn’t work in my new blog for some reason so I was hoping for some help to make it work like it did before (I like all of my images centered, it’s ok!)

    Do you know what I’d need to change to duplicate this on my new blog?

    Hello,
    No, playing with images is not my strong point in CSS. Usually a website would not have that many different divs for the same thing you are trying to accomplish.

    Thanks.

    Thread Starter benconners

    (@benconners)

    OK thanks. I know it’s possible because it’s been done before, so hopefully someone else will chime in.

    Have a good night!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Center Post Images’ is closed to new replies.