0
<div id="zgoraj">
                <a  href="">Domov</a>
                <a   href="">Moj profil</a>
                <a   href="">Administracija</a>
                <a  href="" >Urejanje urnikov</a>
                <a   href="">Statistike</a>
            </div>
<style>
#zgoraj{
width:670px;
background-color:#FF8000;
height:54px;

}
#zgoraj a{
border-style:solid;
border-width:2px;
border-color:black;
padding-top: 20px;
display:block;
float:left;
width:130px;
height:30px;
text-decoration:none;
color:white;
text-align:center;
/*box-shadow: 0 -7px 22px 6px #000000 inset;*/
}
#zgoraj a:hover{
    color:black;
    background-color:white;

}

</style>

这是我的“菜单栏”的代码。When A link is selected and you are redirected to the specified url I would like the the hover effect to stay on(I will edit href attributte).

4

1 回答 1

1

假设你在每个页面的顶部都有相同的菜单,你需要更新你的 CSS 来为你的悬停样式添加一个额外的类定义:

#zgoraj a:hover, #zgoraj a.active {
  color:black;
  background-color:white;
}

然后将 'class="active"' 添加到应该突出显示的 <a> 元素中。

于 2012-09-20T19:35:06.373 回答