Images won’t align in WordPress editor

Keith Curreri - Blog Headshot

By Keith Curreri on November 09, 2010

Rarely you may be working with a WordPress theme that won’t allow you to align images via the WordPress editor. If the WordPress theme you are working with does not let you position images so that they float to the left or right there may be a lack of styling in the CSS. Luckily, if this is your problem there is an easy fix.

Try opening your CSS stylesheet (using an FTP client) in the WordPress theme folder and add the following styling code:

img.centered {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.aligncenter{
    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;
}

.alignright {
    float: right;
}

.alignleft {
    float: left;
}

Hopefully now when you try to align images they should work just fine!

Leave a Reply

5 Comments on "Images won’t align in WordPress editor"

Notify of
avatar
Luke T

I was looking for a solution specifically like this for a while now.

I am comfortable editing CSS myself, but I needed for the WYSIWYG editor in WordPress to enable staff with no web coding skills to be able to create pages using only the tools in the console. This image alignment issue was one such formatting feature which simply wouldn’t work as intended with the template I had selected – but this solution resolves that issue.

Thanks for sharing! 🙂

Keith

Luke,

I hope that you can find something that works!

-Keith

Mitch

That might work. Or you could just share this with them. lol

Keith

Mitch,

Nice tip! I can see that you have come across image alignment issues in the past as well.

Mitch

Oh yeah, and it irritated me enough to figure out what to do.

wpDiscuz