输入标签的宽度不超过20px

时间:2016-09-07 13:17:02

标签: javascript html css

我需要将类型按钮的输入标签的宽度设置为16px,但不要将宽度设置为低于20px,并且不会减小尺寸。

enter image description here

我想要一个带有绿色检查图像的按钮,其尺寸应低于20px,但我无法使用输入标签。如果我只是简单地使用img而不是输入标签,那么它就不会像按钮一样具有相同的印刷效果。

任何帮助都将不胜感激。

2 个答案:

答案 0 :(得分:2)

它的尺寸低于20px。您需要覆盖证明按钮上的固有填充 enter image description here

清楚了解按钮的默认设置(忽略最里面的框)

enter image description here



.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>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

尝试使用与按钮尺寸相同的图像尺寸

<input type="button" style="width:16px; height:16px; background-repeat:no-repeat; background-image:url(Styles/Images/imgres.png)"/>

此处我的图像尺寸与按钮尺寸16px * 16px

相同