input button和text在不同浏览器中的默认样式

button的width和height和标准的盒模型不一致,是指的包含边框在内的宽度和长度
测试代码:
<!DOCTYPE html>
<html>
<body>
<input id="box" type="text"></input>
<input type="button" value="按钮"></input>
</body>
</html>

1,chrome

(1)text
内容区域:169*15px
padding:1px 0
border:2px;
margin:0
所以总宽度是:169+4=173px
总高度是:15+6=21px;
(2)button
内容区:26*15
padding:1px 6px
border :2px
margin:0
所以总宽度是:26+(6+2)*2=42px
总高度是:15+6=21px;

2,firefox

(1)text:149*16px
padding:2px;
border:1px
margin:0
所以总宽度是:149+6=155px
总高度是:16+6=22px;
(2)button:39*16
padding:0 6px
border:3px
margin:0
所以总宽度是:32+18=57px
总高度是:16+6=22px;
 

3.ie

(1)text:142.16*15.2
padding:2px 1px
border:1px
margin:0
所以总宽度是:142.16+4=146.16px
总高度是:15.2+6=21.2px;
(2)button:26.66*15.2
padding:3px 10px
border:1px
margin:0
所以总宽度是:26.66+22=48.66px
总高度是:15.2+8=23.2px;
 
html中换行写了input两个input之间才会有空格的,并不是外边距起的作用,但是button上面有文字的时候会把button撑开,各浏览器的表现也不相同
加了一个空格之后,chrome内容区域加了4px,ie加了6.67px但是firefox宽度没有增加,高度增加了2px...

转载于:https://www.cnblogs.com/wmx--/p/4387651.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值