Fix WordPress Image Align Feature

Posted by Quentin Rademaker on Sun, Nov 9, 2008

Share This - Open-Source, Wordpress

There is one WordPress feature that was introduced with version 2.5 that always made me curious: the image alignment feature of the “Add media” editor. Why? Because it never worked!

imgcenter

I knew that I was probably doing something wrong, but since I didn’t have time to find it out, I just kept choosing “none” as the alignment, and then I would manually insert the right, left or center alignment attribute on the image tag.

I got a message saying that since version 2.5 WordPress themes were required to have the following code on their stylesheet but even themes for WP2.6 and up have the same issue (nobody seems to ad this modification in their themes). But you can fix it by adding the following to your themes css stylesheet….

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;
}
.alignright {
float: right;
}
.alignleft {
float: left;
}

Now if you faced this problem in the past, now you know how to solve it.

How would you rate this solution?
VN:F [1.8.1_1037]
Rating: 9.3/10 (3 votes cast)

Fix WordPress Image Align Feature9.3103



Did You Like This Article? Help Spread It

del.icio.us RSS Feed technorati StumbleUpon Facebook Mixx Digg


Why not subscribe to the RSS feed or
to daily or weekly email updates, right now!

Got something to say about this article? Feel free to leave a comment or two. Why not? It's free ;-)



This is a Gravatar enabled website. A nice little picture will show next to your comment rather than the default grey symbol if you get your own globally recognized avatar. Please register at Gravatar. If you don't feel like it then that's not a problem. I will publish all comments automatically when I know you - after your first post - and I appreciate your feedback.