views:

981

answers:

5

I am using XHTML 1.0 Strict on my website and have the following CSS style on my links:

a:hover {
    border-bottom: 1px dotted #447799;
}

and my images:

a img, img {
    border: none;
    text-decoration: none;
}

Yet, when I hover over my title banner the bottom border still shows up dotted and blue. Obviously, I can't use border="0" because it is not part of the XHTML 1.0 Strict Doctype.

You can see my site here: armorycraft.com

Suggestions?

+3  A: 

You could use a class:

a.imageAnchor:hover {
    border:none;
}

Not the most beautiful solution, but it should work.

Joel Potter
I was trying to avoid creating classes, but I'll try it.
Jayrox
This method worked. I would prefer a classless method if possible. If I cannot find a working method, I will accept this answer.
Jayrox
The problem is that the border you see is on the anchor not the image. There is no css-only way to back reference the anchor and remove the border if it contains an image. You could do it with javascript, but I'm guessing that would be overkill.
Joel Potter
True, I'll accept your answer. Thanks :)
Jayrox
There would be CSS-only ways if browsers actually implemented CSS properly.
Peter Boughton
@Peter: I'm pretty sure there is no CSS standard to define look aheads, at least in 1 or 2. If you know of one I'd be really interested to learn it.
Joel Potter
A: 

Try this:

a img:hover, img:hover {border:none; text-decoration:none;}
VirtuosiMedia
Negative, didn't work. :(
Jayrox
A: 

Problem is border is attached to the anchor, but then you're setting a border: none to the image.

There's no simple way to avoid this. I'd suggest tweaking the thing a little bit:

a:hover {
    border-bottom: 1px dotted #447799;
}

a.image:hover {
    border: none;
}

So, add the "image" class to all anchors with images and you're done.

Seb
A: 

a:hover has border:1, so automaticly a:hover img als has border:1

I think this would fix it

a:hover img{border:0;}

now you dont need to make a whole new class for it

Bart
A: 

This worked for me: (I think you just forgot the colon (:)

a:img, img {
    border: none;
    text-decoration: none;
}

Good luck!