• Good day, i used caption on one of my post but the text was aligned to left rather it should be aligned to center as defined in the code.

    please see here.
    https://www.geekng.com/2014/06/solution-wordpress-post-editor-page-messed-up.html

    here’s my .wp-caption css in my theme.

    p img,
    .wp-caption {
    	margin-top: 0.4em;
    }
    .wp-caption {
    	background: #eee;
    	margin-bottom: 1.625em;
    	max-width: 96%;
    	padding: 16px 9px 9px;
    	box-shadow: 0 0px 2px #999;
    }
    .wp-caption img {
    	display: block;
    	margin: 0 auto;
    	max-width: 95%;
    }
    .wp-caption .wp-caption-text,
    .gallery-caption {
    	color: #333;
    	font-size: 90%;
    }
    .wp-caption .wp-caption-text {
    	margin-bottom: 0.6em;
    	padding: 10px 0 5px 0px;
    	position: relative;
    	color: #333;
    }
    .wp-caption p {
      margin: 0px;
    }
    
    /*
    .wp-caption .wp-caption-text:before {
    	color: #333;
    	content: '\2014';
    	font-size: 1.125em;
    	font-style: normal;
    	font-weight: bold;
    	margin-right: 5px;
    	position: absolute;
    	left: 10px;
    	top: 7px;
    }
    */
    
    .content .gallery {
    	margin: 0 auto 1.625em;
    }
    .content .gallery a img {
    	border: none;
    }
    img#wpstats {
    	display: block;
    	margin: 0 auto 1.625em;
    }
    .content .gallery-columns-4 .gallery-item {
    	width: 23%;
    	padding-right: 2%;
    }
    .content .gallery-columns-4 .gallery-item img {
    	width: 100%;
    	height: auto;
    }
    
    /* Image borders */
    img[class*="align"],
    img[class*="wp-image-"],
    .content .gallery .gallery-icon img {/* Add fancy borders to all WordPress-added images but not things like badges and icons and the like */
    	padding: 0px;
    }
    .wp-caption img {
    	border-color: #eee;
    }
    a:focus img[class*="align"],
    a:hover img[class*="align"],
    a:active img[class*="align"],
    a:focus img[class*="wp-image-"],
    a:hover img[class*="wp-image-"],
    a:active img[class*="wp-image-"],
    .content .gallery .gallery-icon a:focus img,
    .content .gallery .gallery-icon a:hover img,
    .content .gallery .gallery-icon a:active img {/* Add some useful style to those fancy borders for linked images ... */
    	background: #eee;
    	border-color: #bbb;
    }
    .wp-caption a:focus img,
    .wp-caption a:active img,
    .wp-caption a:hover img {/* ... including captioned images! */
    	background: #fff;
    	border-color: #ddd;
    }
Viewing 1 replies (of 1 total)
  • From what I can tell the rules are imported correctly, all you need to do is to add a text-align:center property for wp-caption-text and then everything should be ok:

    p img,
    .wp-caption {
    	margin-top: 0.4em;
    }
    .wp-caption {
    	background: #eee;
    	margin-bottom: 1.625em;
    	max-width: 96%;
    	padding: 16px 9px 9px;
    	box-shadow: 0 0px 2px #999;
    }
    .wp-caption img {
    	display: block;
    	margin: 0 auto;
    	max-width: 95%;
    }
    .wp-caption .wp-caption-text,
    .gallery-caption {
    	color: #333;
    	font-size: 90%;
    }
    .wp-caption .wp-caption-text {
    	margin-bottom: 0.6em;
    	padding: 10px 0 5px 0px;
    	position: relative;
    	color: #333;
            text-align:center
    }
    .wp-caption p {
      margin: 0px;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Image Caption not aligning’ is closed to new replies.