html a:主动不起作用?

srp*_*srp -1 html css

CSS:

// Highlight to show that the user is viewing current tab.    
// css for the active tab

.HeaderTabs li.tab a { 
   display: block;    //anchor tab 
   padding: 12px 8px 12px 8px;
}

.HeaderTabs li.tab a:link {
   outline: none;  //link works 
   text-decoration: none;
}

.HeaderTabs li.tab a:hover {  //this works hovering over the text
   color: #A4C639;
   font-weight: bold;
}

.HeaderTabs li.tab a:active { //this doesnt work 
   color: #A4C639;
   font-weight: bold;
}
Run Code Online (Sandbox Code Playgroud)

Mr.*_*ien 5

:active选择器在元素处于活动状态时运行,例如当你单击一个元素时,样式将适用,如果你想要设置当前活动选项卡的样式,你需要使用jQuery或服务器端编程,你不能使用样式只需使用:active选择器即可显示当前的活动标签

更多参考