WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Cannot Center Image (7 posts)

  1. Cloudydays
    Member
    Posted 2 years ago #

    http://mitomeru.net/?p=17

    I cannot center the image anymore. It was centered before and I was messing around with the CSS trying to add a border for the image and the gray area for the caption and at some point it stopped being centered. Now I can't get the caption nor the image itself to be centered.

    If someone wants me to list exactly what I edited in the CSS I can post that but I backtracked and it still didn't help.

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    Review the classes called in:

    <div id="content_pa">
    <div id="attachment_40" class="wp-caption aligncenter" style="width: 211px">
    <a href="http://mitomeru.net/wp-content/uploads/2011/11/pirezedmyolver_10.jpg">
    <img class="size-medium wp-image-40" title="pirezedmyolver_10" src="http://mitomeru.net/wp-content/uploads/2011/11/pirezedmyolver_10-201x300.jpg" alt="" width="201" height="300" />
    </a>
    <p class="wp-caption-text">efwefevf43t35t</p></div>

    The <div> uses class="wp-caption aligncenter"
    While the <img> uses class="size-medium wp-image-40"

    We see in the style sheet:

    html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td {
    font-size:100%;
    }

    So img only has font-size:100%;

    remove img from that list and create a new one...if other images on your site will be affected by this (they will) create a new style:

    .newstyle img {
    align:center;
    <-more css->
    }

    and call that in the post.

  3. Cloudydays
    Member
    Posted 2 years ago #

    I'm not sure how to change it in

    <div id="content_pa">
    <div id="attachment_40" class="wp-caption aligncenter" style="width: 211px">

    <img class="size-medium wp-image-40" title="pirezedmyolver_10" src="http://mitomeru.net/wp-content/uploads/2011/11/pirezedmyolver_10-201x300.jpg" alt="" width="201" height="300" />

    <p class="wp-caption-text">efwefevf43t35t</p></div>

    what I tried to do (just now) was remove img from that list and add align:center to

    img a,a img {
    . ..

    not sure what to do..

  4. Cloudydays
    Member
    Posted 2 years ago #

    It might be that im using an outdated version of wordpress..
    looking at this, http://codex.wordpress.org/CSS#WordPress_Generated_Classes, I'm not finding any of that in my CSS.. so I think I'll have to add those in.

  5. Cloudydays
    Member
    Posted 2 years ago #

    Yup, just tried that out and it worked. Now all I need is the caption to be centered..

  6. Cloudydays
    Member
    Posted 2 years ago #

    Ah it's because I had "text-align: justify;" under P to make the body text justified. But now I don't know how to differ the body text from the caption text...

  7. Cloudydays
    Member
    Posted 2 years ago #

    And wow just figured that out too. Alrighty, I'm all good, thanks for helping!

Topic Closed

This topic has been closed to new replies.

About this Topic