代码:
HTML
<button type="radio"/>
CSS
button:focus {
background: red;
}
在手机浏览器中点击,样式不生效
最佳答案
CSS 中的 :focus 伪类用于设置当前由键盘定位或由鼠标激活的元素的样式。这是一个例子
HTML
<div>
<button class="btn" type="button" name="button">
click
</button>
CSS
.btn {
color: #000;
background: red;
.btn:focus {
background: green;
}
关于html - 按钮 :focus style is not working on phone?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52455471/