View Full Version : CSS Border Issues

02-16-2011, 06:10 AM
I want borders for most of my images, except one, so I created a class for that but it still has the border.

#content a img{
border: 1px solid #FFFFFF;

.rss a img{
border: 0px;


<div id ="content">
<h4>Newest Pages <a class ="rss" href='http://absurdity981.com/rss.xml'><img alt='RSS feed' src='feed.png'/></a></h4>

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?

02-16-2011, 07:15 AM
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:

a.rss img

2) you second selector is less specific (http://www.w3.org/TR/CSS21/cascade.html#specificity) 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:

#content .rss img