Now I See Why the WordPress Image Align Feature Was Not Working
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!
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.
Then last week when I was submitting one of my themes for the WordPress Themes Directory I got a message saying that since version 2.5 WordPress themes were required to have the following code on their stylesheet:
margin: 0 0 2px 7px;
margin: 0 7px 2px 0;
Duh! That is why the alignment feature was not working on my blogs, I never added that code! Now if you faced this problem in the past, now you know how to solve it.
Browse all articles on the WordPress category or check the recommended articles for you below:
78 Responses to “Now I See Why the WordPress Image Align Feature Was Not Working”
Thanks! Copied and pasted in the stylesheet and its working like a charm!
I’ve been working on a theme in editor for a while. It’s still not working for me.
TO ALL WHO CAN’T GET IT TO WORK:
I bypassed the stylesheet (i.e. style.css) altogether and pasted the above code into my index.php file, right before the closing tag.
Works now. Try that.
Thanks for the fix! I was searching for why my image align wasn’t working and hit this post. Works perfectly.
Sorry, doesn’t work for me. Must be something wrong with something else in my code if it’s working for everyone else.
Thanks a lot.. You saved me some frustration..
Oh I’ve been looking for this answer for AGES!!! I love you !!!
I just can not get the silly thing to align. There must be some other code we can use.
Very simple and powerfull, thanks!
I was getting mad with the image alignment!
Excellent. Thanks for the quick and simple fix.
Also having the same issue…I have that code but it is not aligning
Where to place that code in blog stylesheet?
Brilliant, thankyou so much!
Thanks for the tip but upon checking, my code is exactly the same as that – but it’s not aligning correctly?!
May you live to be 1000 years old.
Style.css is a long, complicated file. This code presumably should go in a certain section?
One of the posts above says to put in ‘on the content section’??
OK, I don’t get it. Pasted the code in to the css file, updated, checked the images and set the second one to the right and – damn, still the same. What is it I’m missing here?
Gee, I would ahve thought the new big upgrade to 2.7 would have sorted this
Thanks a ton, this is a life saver!
THANK YOU SO MUCH FOR THIS.
This was driving me insane.
Thank you for saving me a time. It’s been driving me nuts for an hour until I came across this post! Thanks
Yeah, really I like this article. Thanks for this nice article
Fantastic! I thought I was going mad after the upgrade to 2.6 on my blog none of the image alignment worked for new images in posts.
You have saved me bacon. Cheers!
No joy here.
Does the code need to be pasted into a certain section of the stylesheet file?
Big Thanks! I was starting to think that my version of WordPress was bust, but you made me think other wise.
I have used this code to align my images perfectly on my blog. However, in the RSS feed reader, e.g. Google Reader, they still don’t float properly. Has anyone else been having the same problem as well? If so, were you able to rectify it? Please share kindly!
thank you for sharing. It works without any problems. I was driving me mad I thought that I can just use new wp themes, but just pasting the code into the stylesheet works!
big help! got any clues on the post at a future date feature? When I set a future date, the post goes out into never never land not to be seen ever again!
OH THANK YOU! I have been so frustrated with this topic and just adding that code to my stylesheet automatically fixed my images.
THANK YOU THANK YOU THANK YOU
Comments are closed.