If the styling for captions in Wordpress 2.6 doesn’t seem to work…

I had some trouble getting the captions to look good in Wordpress 2.6. Here’s how I solved it.

First, I added this code from the default theme to my style sheet:

/* Captions */
.aligncenter,
div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}

.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;
}
/* End captions */

That should have done the trick, but it didn’t. The problem was, the default CSS file has code for .alignright and .alignleft elsewhere, and mine doesn’t. So if the above code doesn’t work, what you need to add somewhere – anywhere in your CSS file – is:

.alignright {
float: right;
}

.alignleft {
float: left
}

That worked for me.

Related posts:
  1. Mozilla Security issue?
  2. Simple ad rotator script
  3. My blog is worth more than my apartment…
  4. Make a leaderboard load after the content in Wordpress
  5. Playing with the theme functions file in Wordpress

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>