Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2008
    Posts
    136
    Thanks
    18
    Thanked 0 Times in 0 Posts

    CSS Border Issues

    I want borders for most of my images, except one, so I created a class for that but it still has the border.

    Code:
    #content a img{
    border: 1px solid #FFFFFF;
    } 
    
    .rss a img{
    border: 0px;
    }
    and
    Code:
    <div id ="content">
    <h4>Newest Pages <a class ="rss" href='http://absurdity981.com/rss.xml'><img alt='RSS feed' src='feed.png'/></a></h4>
    </div>

    Now If I get rid of the content id it takes out the border, and I've experimented with a border of 10 for the rss class so I know that when the content id isn't there the rss class works. Now why is my content id overriding my rss class? I thought that the content covers the whole thing, but if I put the class in with a link it should override the general statements of the content id. Where am I going wrong?

  • #2
    Regular Coder Candygirl's Avatar
    Join Date
    Apr 2008
    Location
    Switzerland
    Posts
    184
    Thanks
    3
    Thanked 56 Times in 56 Posts
    You have 2 problems with your selectors:

    1) the second selector is not pointing on your element. You select the image in an "a" element in any element with the class "rss". The class "rss" is given to your a. The writting should be:

    Code:
    a.rss img
    2) you second selector is less specific then the first one => il will be overwrite by the first one. To give it more specificity you must add the #content in the selector:

    Code:
    #content .rss img
    "Imagination was given to man to compensate for what he is not;
    a sense of humour to console him for what he is."
    -Francis Bacon

  • Users who have thanked Candygirl for this post:

    kochier (02-16-2011)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •