<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 6 年前。
标签 javascript html css
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 6 年前。
我需要将按钮类型的输入标签的宽度设置为 16px,但宽度不会低于 20px,也不会减小尺寸。
我想要一个带有绿色复选图像的按钮,它的大小应该低于 20 像素,但我无法使用输入标签来实现。如果我简单地使用 img 而不是 input 标签,那么它不会像按钮那样具有相同的按下效果。
如有任何帮助,我们将不胜感激。
最佳答案
它确实遵守 20 像素以下的尺寸。您需要覆盖按钮上的固有填充证明:
需要清楚了解按钮的默认设置(忽略最里面的框)
.tick {
height:10px;
width:10px;
}
.tick-20px {
height:20px;
width:20px
}
.btn-10px {
padding: 0;
width: 10px;
height: 10px;
}
<button class="btn-10px"></button>
<button><img class="tick" src="http://www.freeiconspng.com/uploads/accept-tick-icon-12.png"></button>
<button><img class="tick-20px" src="http://www.freeiconspng.com/uploads/accept-tick-icon-12.png"></button>
关于javascript - 输入标签不拾取低于 20px 的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39370984/