html – 从活动按钮中删除突出显示

我有几个按钮样式为选项菜单的选项卡.一切看起来像我想要的,它的工作正常.我唯一的问题是活动按钮上的蓝色突出显示.我该如何删除它?

由于我不明白的原因,我的代码片段不能重现问题.

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>

解决方法

只需添加大纲:0
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";
}
button.menu {
  border: 2px solid grey;
  border-bottom: none;
  margin-bottom: -2px;
  margin-right: 5px;
  padding: 3px 2px;
  position: relative;
  z-index: 5;
  outline: 0;
}
button.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>

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些