我使用CSS3作为我的按钮。我注意到,每当我点击任何按钮时,按钮周围会出现一个矩形的蓝色高光。我不知道是否有任何可以脱掉它的方法。这是我的代码:
.navbar-custom {
background-color:#000000;
color:#ffffff;
border-radius:0;
height:100px;
}
.btn {
box-sizing: border-box;
appearance: none;
background-color: transparent;
border: 2px solid #e74c3c;
border-radius: 0.6em;
color: #e74c3c;
cursor: pointer;
display: flex;
align-self: center;
font-size: 1rem;
font-weight: 400;
line-height: 1;
margin: 20px;
padding: 1.2em 2.8em;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
}
.btn:hover, .btn:focus {
color: #fff;
outline: 0;
}
.sixth {
border-radius: 3em;
border-color: #ec6800;
color: #FFF;
background-image: linear-gradient(to bottom, transparent 50%, #2ecc71 50%);
background-position: 0 0;
background-size: 200%;
transition: background 150ms ease-in-out, color 150ms ease-in-out;
}
</style>
</head>
<body>
<nav class="navbar navbar-custom">
<ul class="nav navbar-nav navbar-right">
<button class="btn sixth">SIGN UP</button>
</ul> </nav>
</body>
答案 0 :(得分:1)
按钮已经有属性<pre>
应该处理这个,必须有一些CSS覆盖这个属性,你使用outline: 0;
或outline:none
,两者基本上都是这样做的请参考here,然后将属性修改为。
<强>之前:强>
outline:0
<强>后:强>
.btn:hover, .btn:focus {
color: #fff;
outline: 0;
}
.btn:focus {
color: #fff;
outline: 0 !important;
}
&#13;
.navbar-custom {
background-color: #000000;
color: #ffffff;
border-radius: 0;
height: 100px;
}
.btn {
box-sizing: border-box;
appearance: none;
background-color: transparent;
border: 2px solid #e74c3c;
border-radius: 0.6em;
color: #e74c3c;
cursor: pointer;
display: flex;
align-self: center;
font-size: 1rem;
font-weight: 400;
line-height: 1;
margin: 20px;
padding: 1.2em 2.8em;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
}
.btn:hover,
.btn:focus {
color: #fff;
outline: none !important;
}
.sixth {
border-radius: 3em;
border-color: #ec6800;
color: #FFF;
background-image: linear-gradient(to bottom, transparent 50%, #2ecc71 50%);
background-position: 0 0;
background-size: 200%;
transition: background 150ms ease-in-out, color 150ms ease-in-out;
}
&#13;
答案 1 :(得分:0)
Box-shadow在某些情况下有帮助
.btn:focus,.btn:active {
outline: none !important;
box-shadow: none !important;
}