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!

Did you like this post? Want to get more like it?

Website Redesign Course
Subscribe
Notify of
guest
5 Comments
Inline Feedbacks
View all comments
Luke T
Luke T
10 years ago

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
Keith
10 years ago
Reply to  Luke T

Luke,

I hope that you can find something that works!

-Keith

Mitch
12 years ago

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

Keith
Keith
12 years ago
Reply to  Mitch

Mitch,

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

Mitch
12 years ago
Reply to  Keith

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

5
0
Would love your thoughts, please comment.x
()
x