【发布时间】:2015-03-07 18:22:12
【问题描述】:
假设我有意见。
html
<input type="text">
css:
input, input:focus {
border: none;
outline: solid 1px grey;
box-shadow: none;
}
点击后,输入会改变大小。我该如何阻止这种情况?
【问题讨论】:
-
不,它没有。 [火狐 36]
假设我有意见。
html
<input type="text">
css:
input, input:focus {
border: none;
outline: solid 1px grey;
box-shadow: none;
}
点击后,输入会改变大小。我该如何阻止这种情况?
【问题讨论】:
如果您在 Chrome 中查看,这是因为以下默认用户代理样式:
input:focus, textarea:focus,
keygen:focus, select:focus {
outline-offset: -2px;
}
因此在关注元素时需要将outline-offset设置为0:
input:focus {
outline-offset: 0;
}
【讨论】: