Support » Fixing WordPress » Cannot Center Image

  • Resolved Cloudydays


    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Review the classes called in:

    <div id="content_pa">
    <div id="attachment_40" class="wp-caption aligncenter" style="width: 211px">
    <a href="">
    <img class="size-medium wp-image-40" title="pirezedmyolver_10" src="" alt="" width="201" height="300" />
    <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 {

    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 {
    <-more css->

    and call that in the post.

    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=”×300.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..

    It might be that im using an outdated version of wordpress..
    looking at this,, I’m not finding any of that in my CSS.. so I think I’ll have to add those in.

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

    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…

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Cannot Center Image’ is closed to new replies.