WordPress: text-align fix
Posted: July 10th, 2009 | Author: Bernhard | Filed under: CSS, Wordpress | No Comments »I just finished my new template and I was ready to test how it looks, great! but…oops a problem showed up and I couldn’t find what was wrong.
When I posted my first post I tried to float an image to the left and right but nothing happend online…
After a little search I found the problem. The Media Library adds a class on the, in my case image, and does nothing inline as I expected. So add:
/* Wordpress Alignment Fix */ img.centered { display: block; margin-left: auto; margin-right: auto; } img.alignright { margin: 0 0 2px 10px; display: inline; } img.alignleft { margin: 0 10px 2px 0; display: inline; } .alignright { float: right; margin: 0 0 2px 10px; } .alignleft { float: left; margin: 0 10px 2px 0; }
I was a bit dissapointed, because I think it should be somewhere in the core css files of WordPress, since these properties can be overwritten anytime. I mean it’s a standard class added to elements, so it’s always present.


Leave a Reply