【发布时间】:2016-01-26 16:58:58
【问题描述】:
我正在使用 css 制作一个看起来很酷的导航栏,当我将鼠标悬停在链接上时,我希望在链接下方出现一个导航栏。基本上,当我将鼠标悬停在另一个框上时,我需要改变一个框的背景颜色。
这是我的html:
<div id="navbar">
<div class="links">
<table>
<tr>
<td class="link1"></td><a href="Index.html">Calvin and Hobbes</a></td>
<td class="link2"><a href="Index.html">Garfield</a></td>
</tr>
<tr class="hoverbar">
<td class="link1hover"></td>
<td class="link2hover"></td>
</tr>
</table>
</div>
</div>
这是我的 Css:
.links {
float:right;
font-size:200%;
}
#navbar table{
margin-top:30px;
border-spacing:40px 0px;
}
#navbar td {
line-height:30px;
}
.hoverbar {
height:5px;
}
.link1:hover + .link1hover {
background-color:#FF5C00;
}
.link2:hover + .link2hover {
background-color:#FF5C00;
}
a:link {color:black; background-color:transparent; text-decoration:none}
a:visited {color:black; background-color:transparent; text-decoration:none}
a:hover {color:#FF5C00; background-color:transparent; text-decoration:none}
a:active {color:#FF5C00; background-color:transparent; text-decoration:none}
【问题讨论】: