WordPress.org

Ready to get started?Download WordPress

Forums

Change default image border colour (9 posts)

  1. deadlyknitshade
    Member
    Posted 2 years ago #

    Hi

    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?

    Thanks

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

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

    what theme are you using?

    link to your site?

  3. elizzz
    Member
    Posted 2 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
    Member
    Posted 2 years ago #

    I'm not sure where to change the code.

    My site is here:

    http://www.whodunnknit.com/

    Sorry I should have linked it first.

    I'm using an Elegant Themes theme.

  5. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    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
    Member
    Posted 2 years ago #

    Hi

    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?

    Thanks.

  7. deadlyknitshade
    Member
    Posted 2 years ago #

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

  8. Alex
    Member
    Posted 2 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' ){
    			$(this).css({"border-color":"#09345b"});
    		}
    });

    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
    Member
    Posted 2 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