• Resolved jrcollins

    (@jrcollins)


    this should be easy but I just can’t seem to get it to work. I found the relevant styling in style.css:

    .wp-caption img {
    	border: 0 none;
    	margin: 0;
    	padding: 0;
    }

    …and changed it to:

    .wp-caption img {
        border: 1px solid #e7e7e7;
        margin: 0;
        padding: 0;
    }

    …but nothing happened.

Viewing 7 replies - 1 through 7 (of 7 total)
  • try to add !important to override default values so it will be

    .wp-caption img {
        border: 1px solid #e7e7e7 !important;
        margin: 0;
        padding: 0;
    }

    Thread Starter jrcollins

    (@jrcollins)

    I tried that but still no border! Thanks anyway.

    Just make sure that the container before the <img> is “.wp-caption” class. something like this

    <div class="wp-caption">
       <img /> //image under wp-caption class container
    </div>

    You can use Firebug or similar
    Hope that helps

    .wp-caption img {} will only style images with a caption text;

    try (untested without a live link to the problem):

    .hentry img { border: ....; }

    try to use Firebug https://getfirebug.com/ or a similar browser tool to investigate these kind of formatting problems.

    Thread Starter jrcollins

    (@jrcollins)

    I was just looking at the style.css coding for the image, not the whole element (ie. image and caption). After finding this I was able to change the settings for the border. Not so hard after all!
    Just wondering is it possible to put a border around the image only or would I have to do that before adding the caption?

    The border around both is being set by this:

    .wp-caption {
        background: none repeat scroll 0 0 #F3F3F3;
        border: 1px solid #DDDDDD;
        margin: 0 5px;
        padding: 2px;
        text-align: center;
    }

    You don’t have any border set for the image only — it would go in this CSS:

    .wp-caption img {
        border: 0 none;
        margin: 0;
        padding: 0;
    }

    The above sets a border on images that are inside elements with the .wp-caption class.

    Thread Starter jrcollins

    (@jrcollins)

    Ok, got it! Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘adding border to post images’ is closed to new replies.