Forums

Cannot Center Images (6 posts)

  1. efpeterson
    Member
    Posted 1 year ago #

    Hi there,

    I've been having a hard time centering images in this theme. I have deleted the images section of the CSS file so that it would just take the Word Press defaults, but I've made no progress. Text is center aligned without a problem, however images will not center or right align.

  2. randinicole
    Member
    Posted 1 year ago #

    A link the the website would be good so someone can see the setup and look at the css

  3. efpeterson
    Member
    Posted 1 year ago #

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    You need to include the WP default image handling stuff in your css.

    When you assign center/left/right to the image, it drops the class onto the image, but if you have nothing in your css, there is nothing telling it what to do.

    here's my image stuff, you'll need something similar....

    img.centered {
    	display: block;
    	margin-left: auto;
    	margin-right: auto;
    	}
    
    img.alignright {
    	padding: 4px;
    	margin: 0 0 2px 7px;
    	display: inline;
    	}
    
    img.alignleft {
    	padding: 4px;
    	margin: 0 7px 2px 0;
    	display: inline;
    	}
    .alignleft {
    	float:left;
    	padding:2px 0 0 10px;
    	}
    .alignright {
    	float:right;
    	padding:2px 10px 0 5px;
    	}
    .wp-caption.alignleft {
             float:left;
             margin-left:0;
             margin-right:5px;
             }
    .wp-caption.aligncenter {
             margin-left:auto;
             margin-right:auto;
             }
    .wp-caption.alignright {
             float:right;
             margin-left:5px;
             margin-right:0;
             }
  5. efpeterson
    Member
    Posted 1 year ago #

    RVoodo,

    I added your CSS to my style sheet and it didn't work. I also modified a few margins and that didn't move it over at all either. Odd...

  6. Sexleksaker
    Member
    Posted 1 year ago #

    Try adding style="align:center" in the img tag and you can also put <center></center> around the image tag... ugly but usually one of them works.

Topic Closed

This topic has been closed to new replies.

About this Topic