stefan
stefan

Reputation: 55

No Image change - css

What's wrong with this code? When i tried it with border-style, border-with, so it works. but it doesn't work with background-Image.

<!DOCTYPE html>
<head>
    <style type = 'text/css'>
    a.test:hover span{
        background-image: url('bearbeitenx.png');
    }

    //.test { background-image:url('unbenannt.png');}
    }
</style>
</head>
<body>


<a href = 'eerwerqwerwer' class = 'test'><span style = 'background-image: url(bearbeiten1.png); width:40px; height:40px; display: block; background-repeat: no-repeat;' ></span></a>
</body>
</html>

Upvotes: 0

Views: 33

Answers (3)

Shelly
Shelly

Reputation: 351

DEMO : http://jsfiddle.net/gn5mfpww/3/

This will work with

a.bearbeiten1-png:hover{
    background-image:     url('http://www.galliano.cc/Test_seite/cms/uploads/bearbeitenx.png');
}

Moved the image to little right to see if the background image is forming or not .

Upvotes: 0

Mike Brant
Mike Brant

Reputation: 71384

I imagine the CSS selector should be a.bearbeiten1-png:hover. Your current CSS is applying that hover style to an a that is a descendant of an element classed as bearbeiten1-png. That doesn't match how your HTML is structured.

Upvotes: 0

Quentin
Quentin

Reputation: 943100

.bearbeiten1-png a:hover matches a hovered anchor element that is a descendant of an element that is a member of the bearbeiten1-png class.

You have no such element.

a.bearbeiten1-png:hover would match your anchor, but you probably still wouldn't see a difference because your <img> element is likely to cover up the background image.

Upvotes: 1

Related Questions