WordPress.org

Forums

Add default image border (10 posts)

  1. Leah
    Member
    Posted 1 year ago #

    Please help!
    I have my own theme and want a default white border to be added for all my posted images. I don't know code or where to place it. I have been searching online trying to find an answer.

    Thanks!

  2. marcelvanderhoek
    Member
    Posted 1 year ago #

    A line of CSS will do the trick:

    img{
    border: 2px solid white;
    }
  3. Leah
    Member
    Posted 1 year ago #

    Thank You Marcel but I don't want a border on all my elements only the photos I post. What should I do?

  4. xavortm
    Member
    Posted 1 year ago #

    You must select the tag that hold the posts. Check it with your browser debugger and write it. Could be something like that:

    .entry img {
      /* your code */
    }

    Remember, don't copy-paste it, check what is your entry tag!

  5. Leah
    Member
    Posted 1 year ago #

    I'm not exactly sure what you mean. I know very little coding. Can yo give me step by step instructions. Thanks

  6. xavortm
    Member
    Posted 1 year ago #

    I can not tell you what is your theme's post wrapper CSS class to give you exact tip. Can you link me your site, this will greatly help. (and please, next time you have such questions link the site if its hosted somewhere)

  7. Leah
    Member
    Posted 1 year ago #

    My site is leahmarieblog.com, under Galleries tab is the example of a photo posted that needs a border.

    Thanks

  8. xavortm
    Member
    Posted 1 year ago #

    It can be styled like that:

    Select all images that are not floated to left or right, but you could just add the stylings for this with theWordPress CSS classes

    img.alignnone {
      /* your code */
    }

    or

    reach it by the way the theme is structored:

    #container #left img {
      /* your code */
    }

    The first one will select all images from all posts and apply styles to them and the secound will select all images from the div#container #left and apply styles to them.

    This is all you can do with the current theme structure. If you have more questions, ask ;)

  9. Leah
    Member
    Posted 1 year ago #

    Thanks Xavortm! That worked, but now I realize that my white border does not show up on my white background. How do I change the color to an off white?

  10. Leah
    Member
    Posted 1 year ago #

    I just found a plug in WP Image Borders..I'm going to try that to get the look I'm going for.

    Thanks

  11. xavortm
    Member
    Posted 1 year ago #

    Instead of border: 2px solid white; You can write the color you need at the place of "white". You can write HEX colors like #ddd, #ccc and such. Made your own here : http://www.colorpicker.com/. (you need to copy the letters above the picker and always have "#" before them)

Topic Closed

This topic has been closed to new replies.

About this Topic