Positioning an image

  • Unknown's avatar

    I added my own image in place of the theme’s image, but it came out left-justified. I want it centered. I checked the css code but all it says is the location reference and the dimensions. I don’t see “position” anywhere.

    Is there a way to center the image?
    Thanks.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi there, add the following CSS which sets the alignment for the parent div of the header image to “center”.

    #site-image {
        text-align: center;
    }
  • Unknown's avatar

    Thank you Happiness Engineer! It worked!
    But as I’m trying to learn more about CSS–why “TEXT” align??
    Susan

  • Unknown's avatar

    Susan, You are welcome.

    How you end up centering something can sometimes depend on what the element is. If we had a div that we wanted to center, we would have typically done that by setting the left and right margins to “auto” which would have make the left and right margins the same. In this case, we wanted to center an image which was inside of a div and images respond to certain text styling declarations such as text align. It would not have responded to auto margin settings.

  • Unknown's avatar

    Thank you. I appreciate the info. Sorry it took so long to reply.
    As you can imagine, it is hard to learn CSS as a hobby!
    Susan

  • The topic ‘Positioning an image’ is closed to new replies.