如何让我的导航按钮保持活动 [英] how to get my navigation button stay active
问题描述
无法使用html和css让我的导航保持活动状态。它只是点亮,但不按住时保持活动。我缺少什么?
如何在按下时保持活动状态?真的需要帮助快!对不起我的错误代码,我是新编码。
如何键入活动类?
< div id =apaknavig>
< div id =menu2>
< ul>
< li>< a href =uznemums.html>Uzņēmums< / a>< / li>
< li>< a href =kontakti.html> kontakti< / a>< / li>
< / ul>
< / div>
< / div>
CSS
#apaknavig {
Width:200px;
height:604px;
top:-613px;
position:relative;
font:14px Arial;
color:black;
float:left;
right:35px;
text-indent:12px;
display:block;
line-height:30px;
}
#menu2 ul {
list-style:none;
float:left;
font:14px Arial;
color:black;
right:90px;
text-decoration:none;
text-align:left; width:10px;
display:block;
line-height:30px;
margin-bottom:10px;
}
#menu2 a {
background-image:url(bildes / apak_navig.png);
display:block;
width:196px;
height:34px;
font:14px Arial;
color:black;
float:left;
right:90px;
text-decoration:none;
display:block;
line-height:30px;
margin-bottom:3px;
}
#menu2 a:hover {
background-image:url(bildes / apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display:block;
line-height:30px;
}
c>#menu2 a:hover {到#menu2 a:hover,#menu2 a:active {
。
您只需在CSS中添加#menu2 a:active
。
#menu2 a:hover,#menu2 a:active {
background-image:url(bildes / apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display:block;
line-height:30px;
}
我试过,但它不工作。它继续只是悬停,但不会保持活动,当我按它。
Can't get my navigation to stay active using html and css. It just light up but does not stay active when pressed. What am I missing?
How do I make it stay active when pressed? Really need the help fast! Sorry for my bad code, I'm new to coding.
How do I type the active class? I tried to, but it did not work.
HTML
<div id="apaknavig">
<div id="menu2">
<ul>
<li><a href="uznemums.html">Uzņēmums</a></li>
<li><a href="kontakti.html">kontakti</a></li>
</ul>
</div>
</div>
CSS
#apaknavig {
Width: 200px;
height: 604px;
top:-613px;
position:relative;
font:14px Arial;
color:black;
float:left;
right:35px;
text-indent:12px;
display: block;
line-height:30px;
}
#menu2 ul{
list-style:none;
float: left;
font:14px Arial;
color:black;
right:90px;
text-decoration:none;
text-align:left; width:10px;
display: block;
line-height:30px;
margin-bottom:10px;
}
#menu2 a{
background-image: url(bildes/apak_navig.png);
display:block;
width: 196px;
height:34px;
font:14px Arial;
color:black;
float:left;
right:90px;
text-decoration:none;
display: block;
line-height:30px;
margin-bottom:3px;
}
#menu2 a:hover{
background-image: url(bildes/apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display: block;
line-height:30px;
}
Just change #menu2 a:hover{
to #menu2 a:hover, #menu2 a:active {
.
You just have to add #menu2 a:active
to the CSS.
#menu2 a:hover,#menu2 a:active{
background-image: url(bildes/apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display: block;
line-height:30px;
}
I tried it but it just does not work. It continues to just hover, but does not stay active when I press it.
这篇关于如何让我的导航按钮保持活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!