Wordpress Image Caption CSS

January 24th, 2009 § 15

If you use anything other than the default Wordpress theme, you’ve probably noticed that image captions look different in TinyMCE than they do on your site. This is because many themes do not include the styles associated by Wordpress with the images you insert into your posts.

In order to get the styles to show up, simply paste the CSS below into your theme’s css file (style.css).  That will get your default styles working, and you can customize from there.

/* 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 */

Tagged:

§ 15 Responses to “Wordpress Image Caption CSS”

What's this?

You are currently reading Wordpress Image Caption CSS at Trey Connell.

meta