Fixing WordPress Image Caption Issues

by Paul Wilson


Earlier this year I wrote about a quick way to fix wordpress themes that wouldn’t wrap text around your images correctly. It was just snidbit of code that you dropped into your style sheet, but it worked like a charm. I have since used the code on several free themes.

Recently, I was having issues with a couple wordpress themes not being able to use the caption section with the image function. Here are some screen shots I created for a friend showing the problem I was having:

Looks Fine in the Post Editor


After sending this to my friend he sent over another really simple css code, which you can drop in to your style sheet. I have tested it on all the themes that had the issue and it works every time (thanks Milan). Here is the code for your benefit:

aligncenter, div.aligncenter
display: block;
margin-left: auto;
margin-right: auto;

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;

Related Posts: