Druckversion des Themas

Hier klicken um das Topic im Orginalformat anzusehen

Forum Sefrengo.org _ Offtopic _ CSS - Hover Problem

Geschrieben von: gunwalt Mon. 9. March 2009, 13:03

Hallo,
brauche eine Tipp in Sachen CSS. Warum funktioniert der "Hover" auf "Item four" nicht?


QUELLTEXT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unbenanntes Dokument</title>
<style type="text/css">
#navcontainer{margin: 0px;padding: 0px;}
#navcontainer ul{margin: 0px;padding: 0px;list-style-type: none;text-align: left;}
#navcontainer ul li { float: left; }

#navcontainer ul li a
{text-decoration: none;background: url(nav_1.gif) no-repeat bottom center;font-size: 10px/12px;float: left;margin: 0px;height: 67px;width: 75px;padding-top: 13px;padding-right: 15px;padding-bottom: 0px;padding-left: 10px;}

#navcontainer li a:hover{background: url(nav_1_.gif) no-repeat bottom center;color: #000000;}

#navcontainer ul li #nav_4{text-decoration: none;background: url(nav_5.gif) no-repeat bottom center;float: left;margin: 0px;height: 67px;width: 75px;padding-top: 13px;padding-right: 15px;padding-bottom: 0px;padding-left: 10px;}


#navcontainer li a:hover #nav_4{background: url(nav_5_.gif) no-repeat bottom center;color: #ff9900;}
</style>
</head>
<body>

<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="#" id="current">Item one</a></li>
<li><a href="#">Item two</a></li>
<li><a href="#" id="nav_4">Item four</a></li>
</ul>
</div>
</body>
</html>

Geschrieben von: saschapi Mon. 9. March 2009, 13:36

QUELLTEXT
#navcontainer li a#nav_4:hover {background: url(nav_5_.gif) no-repeat bottom center;color: #ff9900;}


Ohne test! smile.gif

Geschrieben von: andi Mon. 9. March 2009, 13:37

hallo gunwalt

weil folgende zeile falsch ist:

QUELLTEXT
#navcontainer li a:hover #nav_4{background: url(nav_5_.gif) no-repeat bottom center;color: #ff9900;}


du hast kein element mit der id nav_4 im a-element, das a-element besitzt die id, korrekt:
QUELLTEXT
#navcontainer li a#nav_4:hover {background: url(nav_5_.gif) no-repeat bottom center;color: #ff9900;}


gruss andi


edit: mist, zu langsam tongue.gif

Geschrieben von: gunwalt Mon. 9. March 2009, 18:42

Die Kleinigkeiten sind's, wie immer - besten Dank.

Unterstützt von Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)