我遇到了一个很奇葩的现象:
<style>
.input_style_2{
width: 28px;
height:28px;
margin: 0px 2px;
border: none;
background: #f4f4f4;
line-height: 24px;
text-align: center;
}
</style>
<body>
<input type="button" class=input_style_2 value="-" />
<input type="text" class=input_style_2 value="2" />
<input type="button" class=input_style_2 value="+" />
</body>
这样的3个按钮,在网页上显示是这样的
但是在手机上显示却是这样的
为什么同样的css,button和text的大小不一样呢
如果只是这么简单的一点css的话。岂止是这样,你会发现基本上每个浏览器有可能都有不一样。因为浏览器本身定义了很多的代理样式。比如IOS safari浏览器:
那展示出来的按钮跟你上面这个又不一样。
不同的浏览器默认样式不一样各种坑,所以才会有reset 和 normalize.css,你这里可以是默认的padding不一样。