【发布时间】:2015-07-27 02:44:05
【问题描述】:
我有几个按钮样式为选项菜单的选项卡。一切看起来都像我想要的,并且运行良好。我唯一的问题是活动按钮上的蓝色突出显示。如何删除它?
由于我不明白的原因,我的代码 sn-p 没有重现问题。
function ShowCurrent()
{
document.getElementById('btnCurrent').className = "menu";
document.getElementById('btnFuture').className = "menu off";
}
function ShowFuture()
{
document.getElementById('btnFuture').className = "menu";
document.getElementById('btnCurrent').className = "menu off";
}
.menu
{
border: 2px solid grey;
border-bottom: none;
margin-bottom: -2px;
margin-right: 5px;
padding: 3px 2px;
position: relative;
z-index: 5;
}
.off
{
border-bottom: 2px solid grey;
padding: 2px;
}
.placeholder
{
border: 2px solid grey;
}
<div>
<button id="btnCurrent" class="menu" onClick="ShowCurrent();">Current</button>
<button id="btnFuture" class="menu off" onClick="ShowFuture();">Future</button>
</div>
<div class="placeholder">Just hanging out, taking up space</div>
【问题讨论】:
-
好的,我明白了。选择按钮时将 .blur() 添加到 javascript 会清除蓝色突出显示。
-
太好了,我可以建议它作为那个帖子的骗子吗?
-
我同意问题相同,但解决方案不同。也许我也应该在那里发布我的答案?
-
不,等一下。这个问题是样式 A 标签,而不是按钮。