当鼠标悬停在链接上时,我想为每个链接显示一个 div 元素。我的例子是 4 个链接和 4 个阴影标题.. 这些阴影标题应该被隐藏,只有当鼠标经过指定的链接时才会出现。
这是我现在拥有的代码:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>sample</title>
<style type="text/css">
body {
background:#1d2733;
color:#fff;
margin:0;
}
#col1 {
width:300px;
height:129px;
float:left;
padding-bottom:20px;
}
#col2 {
width:600px;
float:right;
padding-top:150px;
border-bottom: 2px solid white;
}
#shadowedlinks {
width:600px;
float:right;
position:absolute;
margin-top:-30px;
top:0;
}
div.lnk{
position:absolute;
font-size:180px;
text-align:center;
font-weight:bold;
color:#444;
}
#links {
width:600px;
float:right;
position:absolute;
top:0;
padding-top:100px;
}
#links h1 {
float:left;
font-size:30px;
text-align:center;
padding:0 20px;
}
#links h1 a {
color:#fff;
text-decoration:none;
}
#links h1 a:hover{
color:#FF9;
}
</style>
</head>
<body>
<div id="col1">
<h1><a href="index.php"><img src="imgs/logo.png" class="logo" border="0" width="250" height="129" /></a></h1>
</div>
<div id="col2">
<div id="shadowedlinks">
<div class="lnk" id="lnkHome">HOME</div>
<div class="lnk" id="lnk1">LINK1</div>
<div class="lnk" id="lnk2">LINK2</div>
<div class="lnk" id="lnk3">LINK3</div>
</div>
<div id="links">
<h1><a href="index.php">HOME</a></h1>
<h1><a href="link1.php">LINK1</a></h1>
<h1><a href="link2.php">LINK2</a></h1>
<h1><a href="link3.php">LINK3</a></h1>
</div>
</div>
</body>
</html>