WordPress.org

Ready to get started?Download WordPress

Forums

Add default image border (10 posts)

  1. Leahmarie
    Member
    Posted 6 months 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 6 months ago #

    A line of CSS will do the trick:

    img{
    border: 2px solid white;
    }
  3. Leahmarie
    Member
    Posted 6 months 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 6 months 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. Leahmarie
    Member
    Posted 6 months 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 6 months 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. Leahmarie
    Member
    Posted 6 months 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 6 months 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. Leahmarie
    Member
    Posted 6 months 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. Leahmarie
    Member
    Posted 6 months 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 6 months 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)

Reply

You must log in to post.

About this Topic