Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Border-bottom hyperlinks

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26856
    GreatPotato
    Member

    I often like to use border-bottom for my “a” tags – looks nicer to me instead of text decoration.

    However, when i hyperlink an image, the image takes the border.

    Eg:

    #

    I can’t do:

    img a {
    border-bottom: 0;
    }

    As obviously this is wrong and

    a img {
    border-bottom: 0;
    }

    won’t remove it as it’s the “a” and not the image that has the border…

    Any ideas? It’s a simple problem but i can’t think of a way around it.

    #76153
    jamygolden
    Member

    I would say that the most simple solution would be jQuery:

    $('a').has('img').css('border', 'none');
    #76154
    GreatPotato
    Member

    Yeh, that’s exactly what i’ve done for now but it’s not very elegant.

    #76155
    Chris Coyier
    Keymaster

    This is exactly why this discussion is important: https://css-tricks.com/parent-selectors-in-css/

    #76156
    Chris Coyier
    Keymaster

    But also, check this: http://jsbin.com/hidebottomborder

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.