• I want to display a dashed line under text links, but show no text decoration under image links. I’m having a hard time figuring this out. Right now I’ve got this which seems to add the dashed. But how to get rid of the anchored imaged dash?

    .entry a {
    text-decoration: none; /*removes line from underneath links */
    border-bottom:1px dashed; /*dash under links in entries*/
    }

    my site is johndbrown.com

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi John, did you work it out? I’m having a similar problem.

    D.

    use the ‘img’ tag. Below is what I have in my css file. Adapt it to suit.

    .thumbnail a img {
    	height: 68px;
    	width: 90px;
    	border: 1px solid #3399ff;
    	padding: 2px;
    	background-color: #FFFFFF;
    }
    .thumbnail a:hover img {
    	background-color: #CCFF00;
    }
    .thumbnail a:link, .thumbnail a:visited, .thumbnail a:active { /* stops silly image hover box */
    	padding-right: 0px;
    	padding-left: 0px;
    }
    Thread Starter johnbrown77

    (@johnbrown77)

    Tomdebruin,

    Thanks for the post. Question: I’m not using thumbnails. These are just regular full-size graphics. Any ideas there?

    Bet you figured it out.
    It is in, a img {text-decoration: none;}

    Your image is a link to the same size image. Usually their is a smaller image (thumbnail) linked to a larger image.

    Hope this works for you.

    Timothee

    (@timothee)

    This post is pretty old but I had the same question and figured out a way to do what I wanted. There’s probably another way but this seems to be working fine and is quite elegant I think.

    So, instead of having a /img/ element in my /a/ element, I added the image as a background image for the link.

    #mylink {
      background: url(myimage.png) no-repeat top left;
      padding-left: 15px;
    }

    The padding would differ depending on the image obviously. I also had to add some padding at the bottom because the image was cut otherwise. But now, the text is underlined but not the image while both can be clicked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove anchor underline on linked images but not linked text’ is closed to new replies.