How to Activate a New WordPress Theme
Edit a WordPress Theme to Include Photo Gallery Styles
5 Developers of Premium WordPress Themes

How to Add Image Alignment Styles to WordPress Stylesheets

When you upload an image, you can set the alignment for the image as None, Left, Center, or Right. The WordPress theme you’re using, however, may not have these alignment styles accounted for in its stylesheet. If you set the alignment to Left, for example, but the image on the page doesn’t appear to be aligned, you may need to add a few styles to your theme’s stylesheet.

For the purposes of ensuring that you choose the correct alignment for your newly uploaded images, here’s a quick-and-dirty method:

  1. From the Dashboard, choose Appearance→Editor.

    The Edit Themes page opens. All the template files for your active theme are listed on the right side of the page.

  2. Click the Stylesheet template.

    The Stylesheet (style.css) template opens in the text box in the center of the page.

  3. Add your desired styles to the stylesheet.

    These styles are only examples of what you can do. Get creative with your styling.

    Image Alignment Add This to Your Stylesheet (style.css)
    None img.alignnone {float:none; margin: 5px 0 5px 0;} Left img.alignleft {float:left; margin: 5px 10px 5px 0px;} Center img.aligncenter {display:block; float:none; margin: 5px auto;} Right img.alignright {float:right; margin: 5px 0 5px 10px;}
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Add Widgets to Your WordPress.com Blog Sidebar
How to Install a WordPress Theme
The Settings Pages for 3 Popular WordPress Plugins
How to Customize Backgrounds in Twenty Ten WordPress Themes
How to Upload Header Images in Twenty Thirteen WordPress Themes
Advertisement

Inside Dummies.com