在为我的网站创建导航栏时,出于可用性目的,我决定将活动页面选项卡显示为粗体,但是当我更改font-weight
元素上的问题,我从来不知道解决它的方法..
HTML
<ul id="mainNav">
<li class="navItem">
<a class="navLink" id="activeLink">Link 1</a>
</li>
<li class="navItem">
<a class="navLink">Link 2</a>
</li>
<li class="navItem">
<a class="navLink">Link 3</a>
</li>
</ul>
CSS
* {
font-family: Arial;
font-size: 14px;
list-style: none;
margin: 0;
padding: 0;
text-decoration: none;
}
#mainNav {
background: RGB(200, 230, 240);
border-bottom: 1px solid RGB(0, 0, 0);
height: 30px;
margin: 0 auto;
position: relative;
width: 100%;
}
.navItem {
display: block;
float: left;
position: relative;
}
.navItem:last-child .navLink {
border-right: 1px solid RGB(0, 0, 0);
}
.navLink {
border-bottom: 1px solid RGB(0, 0, 0);
border-left: 1px solid RGB(0, 0, 0);
display: inline-block;
height: 30px;
line-height: 30px;
padding: 0 15px;
white-space: nowrap;
}
.navItem:hover .navLink {
background: RGB(120, 200, 250);
color: RGB(255, 255, 255);
cursor: pointer;
font-weight: bold;
}
#activeLink {
background: RGB(90, 170, 220);
color: RGB(255, 255, 255);
font-weight: bold;
}
#activeLink:hover {
background: RGB(110, 190, 240);
}
.navItem:hover .subNav {
display: block;
}