【发布时间】:2019-11-25 10:07:05
【问题描述】:
我有以下样式:
.btn-dropdown {
height: 30px;
background: transparent;
border: solid 1.4px #ffffff;
font-size: 10px;
color: white;
min-width: 0;
max-width: fit-content;
padding-left: 15px;
padding-bottom: 6px;
&:hover {
background: white;
color: $blue;
}
&:active,
&:focus {
background: white;
color: $blue;
box-shadow: none;
outline:none;
&::after {
background: transparent;
}
}
}
html
<button type="button" class="btn btn-dropdown dropdown-toggle">
abcd
<i class="far fa-chevron-down"></i>
</button>
我想实现以下行为:
1) 在第二次点击按钮后,它会失去焦点。
是否可以使用纯 SCSS/CSS?我google了一下,发现了一些不满意的解决方案,比如指针事件:无..
提前致谢
【问题讨论】:
-
也发布 HTML。
-
您不能仅使用 css 计算点击次数,因此您很可能需要 js 解决方案
-
@RazvanZamfir 用 html 编辑了主帖
-
所以在实践中“松散焦点”意味着背景颜色松散,对吧?
-
@RazvanZamfir 正确!它将再次恢复透明。