WordPress.org

Ready to get started?Download WordPress

Forums

Centering image caption text - CSS isn't working! (4 posts)

  1. addictivethoughts
    Member
    Posted 5 years ago #

    I'm trying to center the text on my captioned images, but even after editing the CSS numerous times and making sure it looked fine, the text still shows up at an align-left positioning on captioned images. (And on every single captioned image on the blog - not just one page or select ones.)

    I'm at a loss trying to fix this. Here's my full CSS code if anyone wants to take a quick look and see if they spot something I'm overlooking:

    /*
    Theme Name: WordPress Default
    Theme URI: http://wordpress.org/
    Description: The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.
    Version: 1.6
    Author: Michael Heilemann
    Author URI: http://binarybonsai.com/
    Tags: blue, custom header, fixed width, two columns, widgets
    
    	Kubrick v1.5
    	 http://binarybonsai.com/kubrick/
    
    	This theme was designed and built by Michael Heilemann,
    	whose blog you will find at http://binarybonsai.com/
    
    	The CSS, XHTML and design is released under GPL:
    	http://www.opensource.org/licenses/gpl-license.php
    
    */
    
    /* Begin Typography & Colors */
    body {
    	font-size: 62.5%; /* Resets 1em to 10px */
    	font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    	background: #d5d6d7 url('images/kubrickbgcolor.jpg');
    	color: #333;
    	text-align: center;
    	}
    
    #page {
    	background-color: white;
    	border: 1px solid #959596;
    	text-align: left;
    	}
    
    #header {
    	background: #73a0c5 url('images/kubrickheader.jpg') no-repeat bottom center;
    	}
    
    #headerimg 	{
    	margin: 7px 9px 0;
    	height: 192px;
    	width: 740px;
    	}
    
    #content {
    	font-size: 1.2em
    	}
    
    .widecolumn .entry p {
    	font-size: 1.05em;
    	}
    
    .narrowcolumn .entry, .widecolumn .entry {
    	line-height: 1.4em;
    	}
    
    .widecolumn {
    	line-height: 1.6em;
    	}
    
    .narrowcolumn .postmetadata {
    	text-align: center;
    	}
    
    .thread-alt {
    	background-color: #f8f8f8;
    }
    .thread-even {
    	background-color: white;
    }
    .depth-1 {
    border: 1px solid #ddd;
    }
    
    .even, .alt {
    
    	border-left: 1px solid #ddd;
    }
    
    #footer {
    	background: #eee url('images/kubrickfooter.jpg') no-repeat top;
    	border: none;
    	}
    
    small {
    	font-family: Arial, Helvetica, Sans-Serif;
    	font-size: 0.9em;
    	line-height: 1.5em;
    	}
    
    h1, h2, h3 {
    	font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
    	font-weight: bold;
    	}
    
    h1 {
    	font-size: 4em;
    	text-align: center;
    	}
    
    #headerimg .description {
    	font-size: 1.2em;
    	text-align: center;
    	}
    
    h2 {
    	font-size: 1.6em;
    	}
    
    h2.pagetitle {
    	font-size: 1.6em;
    	}
    
    #sidebar h2 {
    	font-family: 'Lucida Grande', Verdana, Sans-Serif;
    	font-size: 1.2em;
    	}
    
    h3 {
    	font-size: 1.3em;
    	}
    
    h1, h1 a, h1 a:hover, h1 a:visited, #headerimg .description {
    	text-decoration: none;
    	color: white;
    	}
    
    h2, h2 a, h2 a:visited, h3, h3 a, h3 a:visited {
    	color: #333;
    	}
    
    h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar h2, #wp-calendar caption, cite {
    	text-decoration: none;
    	}
    
    .entry p a:visited {
    	color: #b85b5a;
    	}
    
    .commentlist li, #commentform input, #commentform textarea {
    	font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
    	}
    .commentlist li ul li {
    	font-size: 1em;
    }
    
    .commentlist li {
    	font-weight: bold;
    }
    
    .commentlist li .avatar {
    	float: right;
    	border: 1px solid #eee;
    	padding: 2px;
    	background: #fff;
    	}
    
    .commentlist cite, .commentlist cite a {
    	font-weight: bold;
    	font-style: normal;
    	font-size: 1.1em;
    	}
    
    .commentlist p {
    	font-weight: normal;
    	line-height: 1.5em;
    	text-transform: none;
    	}
    
    #commentform p {
    	font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    	}
    
    .commentmetadata {
    	font-weight: normal;
    	}
    
    #sidebar {
    	font: 1em 'Lucida Grande', Verdana, Arial, Sans-Serif;
    	}
    
    small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
    	color: #777;
    	}
    
    code {
    	font: 1.1em 'Courier New', Courier, Fixed;
    	}
    
    acronym, abbr, span.caps
    {
    	font-size: 0.9em;
    	letter-spacing: .07em;
    	}
    
    a, h2 a:hover, h3 a:hover {
    	color: #06c;
    	text-decoration: none;
    	}
    
    a:hover {
    	color: #147;
    	text-decoration: underline;
    	}
    
    #wp-calendar #prev a, #wp-calendar #next a {
    	font-size: 9pt;
    	}
    
    #wp-calendar a {
    	text-decoration: none;
    	}
    
    #wp-calendar caption {
    	font: bold 1.3em 'Lucida Grande', Verdana, Arial, Sans-Serif;
    	text-align: center;
    	}
    
    #wp-calendar th {
    	font-style: normal;
    	text-transform: capitalize;
    	}
    /* End Typography & Colors */
    
    /* Begin Structure */
    body {
    	margin: 0 0 20px 0;
    	padding: 0;
    	}
    
    #page {
    	background-color: white;
    	margin: 20px auto;
    	padding: 0;
    	width: 760px;
    	border: 1px solid #959596;
    	}
    
    #header {
    	background-color: #73a0c5;
    	margin: 0 0 0 1px;
    	padding: 0;
    	height: 200px;
    	width: 758px;
    	}
    
    #headerimg {
    	margin: 0;
    	height: 200px;
    	width: 100%;
    	}
    
    .narrowcolumn {
    	float: left;
    	padding: 0 0 20px 45px;
    	margin: 0px 0 0;
    	width: 450px;
    	}
    
    .widecolumn {
    	padding: 10px 0 20px 0;
    	margin: 5px 0 0 150px;
    	width: 450px;
    	}
    
    .post {
    	margin: 0 0 40px;
    	text-align: justify;
    	}
    
    .post hr {
    	display: block;
    	}
    
    .widecolumn .post {
    	margin: 0;
    	}
    
    .narrowcolumn .postmetadata {
    	padding-top: 5px;
    	}
    
    .widecolumn .postmetadata {
    	margin: 30px 0;
    	}
    
    .widecolumn .smallattachment {
    	text-align: center;
    	float: left;
    	width: 128px;
    	margin: 5px 5px 5px 0px;
    }
    
    .widecolumn .attachment {
    	text-align: center;
    	margin: 5px 0px;
    }
    
    .postmetadata {
    	clear: both;
    }
    
    .clear {
    	clear: both;
    }
    
    #footer {
    	padding: 0;
    	margin: 0 auto;
    	width: 760px;
    	clear: both;
    	}
    
    #footer p {
    	margin: 0;
    	padding: 20px 0;
    	text-align: center;
    	}
    /* End Structure */
    
    /*	Begin Headers */
    h1 {
    	padding-top: 70px;
    	margin: 0;
    	}
    
    h2 {
    	margin: 30px 0 0;
    	}
    
    h2.pagetitle {
    	margin-top: 30px;
    	text-align: center;
    }
    
    #sidebar h2 {
    	margin: 5px 0 0;
    	padding: 0;
    	}
    
    h3 {
    	padding: 0;
    	margin: 30px 0 0;
    	}
    
    h3.comments {
    	padding: 0;
    	margin: 40px auto 20px ;
    	}
    /* End Headers */
    
    /* Begin Images */
    p img {
    	padding: 0;
    	max-width: 100%;
    	}
    
    /*	Using 'class="alignright"' on an image will (who would've
    	thought?!) align the image to the right. And using 'class="centered',
    	will of course center the image. This is much better than using
    	align="center", being much more futureproof (and valid) */
    
    img.centered {
    	display: block;
    	margin-left: auto;
    	margin-right: auto;
    	}
    
    img.alignright {
    	padding: 4px;
    	margin: 0 0 2px 7px;
    	display: inline;
    	}
    
    img.alignleft {
    	padding: 4px;
    	margin: 0 7px 2px 0;
    	display: inline;
    	}
    
    .alignright {
    	float: right;
    	}
    
    .alignleft {
    	float: left
    	}
    /* End Images */
    
    /* Begin Lists
    
    	Special stylized non-IE bullets
    	Do not work in Internet Explorer, which merely default to normal bullets. */
    
    html>body .entry ul {
    	margin-left: 0px;
    	padding: 0 0 0 30px;
    	list-style: none;
    	padding-left: 10px;
    	text-indent: -10px;
    	}
    
    html>body .entry li {
    	margin: 7px 0 8px 10px;
    	}
    
    .entry ul li:before, #sidebar ul ul li:before {
    	content: "0BB 020";
    	}
    
    .entry ol {
    	padding: 0 0 0 35px;
    	margin: 0;
    	}
    
    .entry ol li {
    	margin: 0;
    	padding: 0;
    	}
    
    .postmetadata ul, .postmetadata li {
    	display: inline;
    	list-style-type: none;
    	list-style-image: none;
    	}
    
    #sidebar ul, #sidebar ul ol {
    	margin: 0;
    	padding: 0;
    	}
    
    #sidebar ul li {
    	list-style-type: none;
    	list-style-image: none;
    	margin-bottom: 15px;
    	}
    
    #sidebar ul p, #sidebar ul select {
    	margin: 5px 0 8px;
    	}
    
    #sidebar ul ul, #sidebar ul ol {
    	margin: 5px 0 0 10px;
    	}
    
    #sidebar ul ul ul, #sidebar ul ol {
    	margin: 0 0 0 10px;
    	}
    
    ol li, #sidebar ul ol li {
    	list-style: decimal outside;
    	}
    
    #sidebar ul ul li, #sidebar ul ol li {
    	margin: 3px 0 0;
    	padding: 0;
    	}
    /* End Entry Lists */
    
    /* Begin Form Elements */
    #searchform {
    	margin: 10px auto;
    	padding: 5px 3px;
    	text-align: center;
    	}
    
    #sidebar #searchform #s {
    	width: 108px;
    	padding: 2px;
    	}
    
    #sidebar #searchsubmit {
    	padding: 1px;
    	}
    
    .entry form { /* This is mainly for password protected posts, makes them look better. */
    	text-align:center;
    	}
    
    select {
    	width: 130px;
    	}
    
    #commentform input {
    	width: 170px;
    	padding: 2px;
    	margin: 5px 5px 1px 0;
    	}
    
    #commentform {
    	margin: 5px 10px 0 0;
    	}
    #commentform textarea {
    	width: 100%;
    	padding: 2px;
    	}
    #respond:after {
    		content: ".";
    	    display: block;
    	    height: 0;
    	    clear: both;
    	    visibility: hidden;
    	}
    #commentform #submit {
    	margin: 0 0 5px auto;
    	float: right;
    	}
    /* End Form Elements */
    
    /* Begin Comments*/
    .alt {
    	margin: 0;
    	padding: 10px;
    	}
    
    .commentlist {
    	padding: 0;
    	text-align: justify;
    	}
    
    .commentlist li {
    	margin: 15px 0 10px;
    	padding: 5px 5px 10px 10px;
    	list-style: none;
    
    	}
    .commentlist li ul li {
    	margin-right: -5px;
    	margin-left: 10px;
    }
    
    .commentlist p {
    	margin: 10px 5px 10px 0;
    }
    .children { padding: 0; }
    
    #commentform p {
    	margin: 5px 0;
    	}
    
    .nocomments {
    	text-align: center;
    	margin: 0;
    	padding: 0;
    	}
    
    .commentmetadata {
    	margin: 0;
    	display: block;
    	}
    /* End Comments */
    
    /* Begin Sidebar */
    #sidebar
    {
    	padding: 20px 0 10px 0;
    	margin-left: 545px;
    	width: 190px;
    	}
    
    #sidebar form {
    	margin: 0;
    	}
    /* End Sidebar */
    
    /* Begin Calendar */
    #wp-calendar {
    	empty-cells: show;
    	margin: 10px auto 0;
    	width: 155px;
    	}
    
    #wp-calendar #next a {
    	padding-right: 10px;
    	text-align: right;
    	}
    
    #wp-calendar #prev a {
    	padding-left: 10px;
    	text-align: left;
    	}
    
    #wp-calendar a {
    	display: block;
    	}
    
    #wp-calendar caption {
    	text-align: center;
    	width: 100%;
    	}
    
    #wp-calendar td {
    	padding: 3px 0;
    	text-align: center;
    	}
    
    #wp-calendar td.pad:hover { /* Doesn't work in IE */
    	background-color: #fff; }
    /* End Calendar */
    
    /* Begin Various Tags & Classes */
    acronym, abbr, span.caps {
    	cursor: help;
    	}
    
    acronym, abbr {
    	border-bottom: 1px dashed #999;
    	}
    
    blockquote {
    	margin: 15px 30px 0 10px;
    	padding-left: 20px;
    	border-left: 5px solid #ddd;
    	}
    
    blockquote cite {
    	margin: 5px 0 0;
    	display: block;
    	}
    
    .center {
    	text-align: center;
    	}
    
    .hidden {
    	display: none;
    	}
    
    hr {
    	display: none;
    	}
    
    a img {
    	border: none;
    	}
    
    .navigation {
    	display: block;
    	text-align: center;
    	margin-top: 10px;
    	margin-bottom: 60px;
    	}
    /* End Various Tags & Classes*/
    
    /* 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 */
    
    /* "Daisy, Daisy, give me your answer do. I'm half crazy all for the love of you.
    	It won't be a stylish marriage, I can't afford a carriage.
    	But you'll look sweet upon the seat of a bicycle built for two." */
  2. DonNelson
    Member
    Posted 5 years ago #

    I too have the same issue...
    I've discovered if I leave the caption off, the img centers just fine. I'm currently hunting support posts to see if anyone else has this same issue. I'd love to have the functionality of the caption function.

  3. DonNelson
    Member
    Posted 5 years ago #

    I found this WP moderator link worked for me:

    http://wordpress.org/support/topic/164999?replies=1

    It appears to have some other CSS rules from yours (and some slightly modified); I simply copied and pasted them (and tweaked to my style) and things now work great for me.

    Hope this helped!

  4. ventrilqstman
    Inactive
    Posted 5 years ago #

    This is confusing. It seems WP and theme have to many variations of align definitions. Maybe I'm missing something.

    Anyway I found a solution with some code that worked here...
    http://wprocks.com/wordpress-tips/floating-images-within-the-post-in-wordpress-26/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.