Saturday, June 27, 2026 Strategy, technology, media, and social systems

I Think

Sorin Adam Matei

Analysis, research, maps, and essays from Sorin Adam Matei.

WordPress IMG alignleft or alignright not working with regular CSS

Many WordPress users who have saluted the new media loading/management utility that came with the 2.7 version text editor are mystified by the fact that the images refuse to align right or left when inserted by using the choices offered by the WYSIWYG editor. The problem is that the utility uses its own CSS, which needs to be manually copied and pasted into the CSS stylesheet of each theme. Right, you heard it right, of each theme. The code that needs to be added can be found below. Copy, go to your blog backend, Appearence>Editor>Stylesheet>Past>Save. Voila, it works. It is not very hard, just tedious.

Enjoy….


/******************************************
* Align box
******************************************/

img.centered, .aligncenter, div.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;
}

17 comments

  1. Thanks!

    This CSS worked brilliantly unlike the CSS at the official WordPress Codex which would not do img.alignright properly

    Thanks a million bud.

Join the discussion

Your email address will not be published. Required fields are marked *