WordPress 2.6 Image Align Issue, Solution

August 8th, 2008 · No Comments · Category: Design and Development · Tools · WordPress

I like simplicity because of it’s elegance. Awkward moments and people, unnecessarily complicated tasks, and so forth are my pet peeves. With that said, when WordPress 2.6 came out and I noticed I couldn’t simply float left or right my images in my post, let’s just say I had a little “fit”. I love WordPress, but this is a silly bug that shouldn’t even exist. I could fix this by adding style="float:left;" to each image, but that could prove to be annoying after a while. So, here’s a simple solution. Add the default styles for the alignleft, alignright, etc. classes that WordPress assigns to your images when you click the left, right, center, etc. buttons anyway:

Add the following to your stylesheet. But make shore you don’t already have the following classes defined of course:

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;
}

back to top

Commenting


Leave a reply

back to top