Applying borders to images

Discussion in 'CSS' started by swollenpickles, Apr 5, 2007.

  1. #1
    Ok, another question :eek:

    I'm trying to apply a border to all images in a site using CSS. However, I don't want the border applied to the header image. How can I do this using CSS?
     
    swollenpickles, Apr 5, 2007 IP
  2. dmi

    dmi Well-Known Member

    Messages:
    2,705
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Border for all images>
    img { border: ... }

    No border for images in the header div (or if it's a table put table)>
    #header img { border: none }
     
    dmi, Apr 6, 2007 IP
  3. swollenpickles

    swollenpickles Active Member

    Messages:
    1,271
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Thanks, that's what I thought it might be, but it doesn't seem to be working?

    here is what I have in the css:

    img {
    
       border: 2px solid #10120b;
    
    }
    
    
    #header {
    
       background: none;
       border: none;
    
       }
    
    
    Code (markup):
    The problem is a border still appears around the header. :confused:
     
    swollenpickles, Apr 6, 2007 IP
  4. dmi

    dmi Well-Known Member

    Messages:
    2,705
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    140
    #4
    
    img {
    
       border: 2px solid #10120b;
    
    }
    
    
    #header img {
    
       background: none;
       border: none;
    
       }
    
    Code (markup):
    You haven't read what I posted :p

    #header img { ... }

    When you put #header { border: none } you remove the border off of the div, not the image.
    dmi
     
    dmi, Apr 6, 2007 IP
    swollenpickles likes this.
  5. swollenpickles

    swollenpickles Active Member

    Messages:
    1,271
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Sorry, I misinterpreted. It works now. Thanks very much. rep added
     
    swollenpickles, Apr 6, 2007 IP