Ready to get started?Download WordPress


Change default image border colour (9 posts)

  1. deadlyknitshade
    Posted 3 years ago #


    I want to change the colour of the image border so that when I put a border around an image it is grey instead of black as default.

    Is there a way to do this without doing it manually every time?


  2. probably by changing/adding some styles in style.css of your theme;

    what theme are you using?

    link to your site?

  3. elizzz
    Posted 3 years ago #

    Sure... you need to modify the default border color in the css of the theme you are using... Some theme might have an interface to modify them, else, go editing the css directly is the solution...

  4. deadlyknitshade
    Posted 3 years ago #

    I'm not sure where to change the code.

    My site is here:


    Sorry I should have linked it first.

    I'm using an Elegant Themes theme.

  5. i can't find any instances of images with black frames - the stylesheets don't have img styles with borders;

    can you post a direct link to a post/page where the 'default' black border shows, and where you have edited that to grey?

  6. deadlyknitshade
    Posted 3 years ago #


    I have manually changed them to grey. Maybe I should explain more clearly.

    When I add a border to an image via the Add Image button it adds a black-coloured border as default which I then have to manually change to grey. I want to set the style sheet or add a grey-coloured border by default instead of black. Is there any way to do this?


  7. deadlyknitshade
    Posted 3 years ago #

    I understand I have to edit the CSS but am not sure which bit to edit.

  8. Alex
    Posted 3 years ago #

    I had the same problem. Found the solution with jQuery. This might work for you too

    $('.entry-content img').each(function() {
    		  var brdrColor = $(this).css("border-left-color");  
    		if ( brdrColor == 'rgb(0, 0, 0)' || brdrColor == '#000000' ){

    in my case .entry-content is container for wp_content(), so the script checks if there is an image inside the content with default (black) border and replaces the color with new one

  9. deadlyknitshade
    Posted 3 years ago #

    Thanks! Looks useful but I can't find where that code might be. Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic