On 5/1/08, Dean Matthews <[EMAIL PROTECTED]> wrote:
> When you set up an anchor rule that has an underline on hover meant for
> text, is there a simple way to prevent the underline on image links in the
> same ID or do you have to set up a separate class with anchor rules?

By "underline" do you mean the underline text-decoration or a bottom
border? If it's the former, it isn't really an issue. Browsers
won't—as far as I know—add an underline or border to image links even
if you've declared it to be there on hover. The trick is you want to
change the styles on the image inside the anchor instead of the anchor
itself. Like so:

a img {
border: 0;
}

Or what have you.

If you're adding a border-bottom to links and you don't want it to
show up on images you have a wholly different problem. In this case
the border is being applied to the link that just so happens to have
an image inside of it. It won't put an underline, because that
underline is a text decoration and there ain't no text in the link.
There's no CSS selector to target something that has a child.

The way I see it you have a few options:

1.) Apply a class to every anchor with an image.
2.) Make sure all of your images are inside another element with a
class or id and then target the links inside of it.
3.) Use JavaScript to crawl through the document looking for links
that meet an if loop.
4.) Scrap the whole idea of a bottom border on links and use the underline.

I tend to choose option 4.

*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to