Forums

Give help. Get help.

  • # May 15, 2008 at 2:07 pm

    I’m designing a page where all text links need to have a little icon next to them to help denote that they’re links. So my CSS (simplified) looks like this:

    Code:
    a {
    background-image: url(‘link.jpg’);
    background-position: left center;
    background-repeat: no-repeat;
    padding-left: 10px;
    }

    The padding-left bumps the text over so that it isn’t sitting on top of the link icon.

    The problem is that sometimes I have other icons that are contained in links (like, for example, a document icon denoting a download), but I don’t want the link.jpg icon next to it. In such a case, my HTML looks like this:

    Code:

    Is there any type of CSS selector where I can say, "if an image is contained by a link, style that parent link like X?"

    I realize that I could just make a separate class that doesn’t have the background image and apply it to every link that contains an image, but it would be much cooler if this could be done automatically. Is it possible? Does anyone know? :lol:

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag