WordPress.org

Ready to get started?Download WordPress

Forums

Can't get images to center (7 posts)

  1. grizzarkhov
    Member
    Posted 4 years ago #

    The images I'm inserting into this theme are set to CENTER alignment. But when posts are published they're aren't centered. I checked the code and the wordpress css is intact:

    .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto
    }

    But it doesn't seem to be applying itself correctly to the div that the image is in <div id=attachment_6">. I think the issue is that this div isn't as wide as the content area. I can't find css for attachment_6.

    Help!

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    without a link to your site, there is not much advice to give.

    is there a class="wp-caption aligncenter" in the code as well?

    you may need to add a style to style.css for:

    .wp-caption.aligncenter {display: block;
    margin-left: auto;
    margin-right: auto
    }

    (also .wp-caption.alignleft {} and .wp-caption.alignright {} )

  3. grizzarkhov
    Member
    Posted 4 years ago #

    OMG! Life saver! Thank you. That was near making me crazy. *sigh*

  4. amomsrantings
    Member
    Posted 3 years ago #

    Okay, i've searched the forums and nothing i've seen so far works for my blog. Word press is so different from blogger. I am new to word press and to css so please be patient. I can not get images to center now either. Tell me what i'm doing wrong. Let me know any other info you need and i'll post it.

    see example here http://www.amomsrantings.com/posts/wholly-guacamole/

  5. jrav001
    Member
    Posted 3 years ago #

    amomsrantings, you need to add this to your styles.css

    .aligncenter, div.aligncenter {
    	display: block;
    	margin-left: auto;
    	margin-right: auto;
    }
  6. Frumph
    Member
    Posted 3 years ago #

    I use:

    .aligncenter {
    	margin: 0 auto;
    	display: block;
    }
  7. intenseblog
    Member
    Posted 3 years ago #

    I use this for my website at intenseblog:

    .aligncenter, div.aligncenter {
    	display: block!important;
    	margin: 20px auto;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic