Jump to content

CSS - how to not underline images that are links?


Guest estelle

Recommended Posts

Guest estelle

Does anyone know how to *not* underline images that are links?

Example

a { text-decoration: underline; }

a:hover { text-decoration: none; }

<a href="..."><img src="..."><br/>text</a>

EDIT: Example shown here: http://www.beadberry.com/index.php?act=viewCat&catId=50

The image is underlined (except when the mouse hovers over it). Really what i want is *only* the text to be underlined. And i want this style to be standard - i don't want to have to apply a class to every single link or every single image.

I have tried everything i can think of to stop this from happening. E.g.

img { text-decoration: none; }

img:hover { text-decoration: none; }

a img { text-decoration: none; }

I know there's a way to do this, but none of the above work and i just don't know my CSS well enough to figure this out ;)

Link to comment
Share on other sites

img:hover doesn't really mean anything, a img:hover or a:hover img (I use the second case)

I've never had this problem. By default, text should get underlined, therefore "text-decoration: none;"

By default, images get blue borders, therefore

a:hover img {

border: none;

}

Where can I see this in practice? ;)

Link to comment
Share on other sites

Guest estelle

Okay, i just made a quick test html file and it worked fine, so i must have over simplified the problem.

It must be something to do with the fact that two classes are involved, txtDefault and imgDefault.

Example shown here: http://www.beadberry.com/index.php?act=viewCat&catId=50

Mark, if you know off the top of you head what the solution is, then let me know. But i don't want anyone wasting any significant time over this, because its only a tiny annoyance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...