WordPress image captions are not formatted and won’t center

wordpress-logo-notext-rgbI recently had a WordPress theme where the image captions would not be formatted. I wanted the standard grey box with text below the image but it was looking like the caption text was just floating in the middle of the page. I was able to get the formatting corrected by adding some code to my css file but that resulted in making all captioned images left align. I finally got it correct by adding this code to the css file.

/* -----------------------------------------------------------------------------------

Start Image Captions
<a href="http://designm.ag/tutorials/wordpress-caption/%20" target="_blank">http://designm.ag/tutorials/wordpress-caption/ </a>
<a href="http://wordpress.org/support/topic/style-sheet-looks-correct-to-me-but-image-captions-wont-align" target="_blank">http://wordpress.org/support/topic/style-sheet-looks-correct-to-me-but-image-captions-wont-align</a>

--- */

.wp-caption {
border: 1px solid #ddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
margin: 10px;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
.wp-caption img {
margin: 0;
padding: 0;
border: 0 none;
.wp-caption p.wp-caption-text {
font-size: 11px;
line-height: 17px;
padding: 0 4px 5px;
margin: 0;

img.aligncenter, div.aligncenter {
margin-left: auto;
margin-right: auto;
text-align: center;

/* --- End Image Captions --- */


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s