Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Removing underline from image that is linkable

Featured Replies

Hey all!

 

As some of you know i designed my portfolio site a month or 2 back and im only getting round to coding it now. I'm only doing a quick draft of it, just to see how things will look when its completely finished.

 

I have problem tho with the images on my site. I have some linkable images, when ever you roll over them, my rollover for my links appears below the image. How do i remove this?

 

http://www.tylercollins.co.uk

Is it the green dotted border-bottom from

a:hover { color: #8cc400; border-bottom: 1px dotted #8cc400; text-decoration: none; }

 

You already have img, a:link, a:hover {

border: none;

text-decoration: none;

padding-bottom: 8px;

}

so it can't be that.

 

Try

img.noborder { border: none; text-decoration: none; }

and add a class into each image

<img class="noborder" src="images/drumcorn.png" alt="Drumcorn Farm Cottage Preview" />

 

Edit 08 August:-

after reading the following posts my code above wouldn't work as it's on the img element but the border-bottom is on the a href element, so my code would have to be

a.noborder:hover { border: none; } with a class for the "a" element

<a class="noborder" href="http://www.drumcornfarmcottage.co.uk"><img src="images/drumcorn.png" alt="Drumcorn Farm Cottage Preview" />

 

It might seem easier to move the

img, a:link, a:hover {

border: none;

text-decoration: none;

padding-bottom: 8px;

}

styles after the border-bottom style but that removes the border-bottom from the text links so the best metod is to use the first-child method (which I don't think works in IE6) or my class a.noborder:hover { border: none; } on the "a" tag.

It's this line causing it:

 

a:hover             { color: #8cc400; border-bottom: 1px dotted #8cc400; text-decoration: none; }

 

The border-bottom bit.

 

To remove from only linked images, but not all links, simply add after that line:

 

a:hover img             { border-bottom: none; }

Is it the green dotted border-bottom from

a:hover { color: #8cc400; border-bottom: 1px dotted #8cc400; text-decoration: none; }

 

You already have img, a:link, a:hover {

border: none;

text-decoration: none;

padding-bottom: 8px;

}

so it can't be that.

 

The code there that removes the border-bottom is located before the one that add it - hence why it doesn't take any effect.

Hey all!

 

As some of you know i designed my portfolio site a month or 2 back and im only getting round to coding it now. I'm only doing a quick draft of it, just to see how things will look when its completely finished.

 

I have problem tho with the images on my site. I have some linkable images, when ever you roll over them, my rollover for my links appears below the image. How do i remove this?

 

http://www.tylercollins.co.uk

 

 

If you want to keep your CSS and markup as is without adding any classes to your images then you could add:

 

a:first-child:hover{
border: none;
}

 

To be honest though I think your CSS needs quite a bit of tidying up.

To remove from only linked images, but not all links, simply add after that line:

 

a:hover img             { border-bottom: none; }

 

I'm pretty sure that wouldn't work.

The code there that removes the border-bottom is located before the one that add it - hence why it doesn't take any effect.

 

Yes, I thought the

img, a:link, a:hover {

border: none;

text-decoration: none;

padding-bottom: 8px;

}

should work, but I didn't notice that the other style with the dotted border was after it.

I'm pretty sure that wouldn't work.

 

You're right. that rule would affect the IMG element - not the A element that adds the effect.

Yes, I thought the

img, a:link, a:hover {

border: none;

text-decoration: none;

padding-bottom: 8px;

}

should work, but I didn't notice that the other style with the dotted border was after it.

You could benefit from organising your CSS into clear sections so you can trace all your rules easier. Rules overlapping each other happens all to easily.

  • 2 weeks later...

Hi, were you able to resolve this issue?

 

Looks like a nay, This would work

 

p strong + a:hover{color: #8cc400; border-bottom: 1px dotted #8cc400; text-decoration: none;}
p a:hover{border-bottom:none}

 

but i don't think IE6 supports the sibling selector?

 

But is that really a big issue?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.