Html 为什么按钮元素';s的高度与具有相同高度属性的同级输入元素的高度不匹配?
我有以下资料:Html 为什么按钮元素';s的高度与具有相同高度属性的同级输入元素的高度不匹配?,html,firefox,google-chrome,css,Html,Firefox,Google Chrome,Css,我有以下资料: <div style="border:solid 1px gray; height:22px; line-height:22px; display:inline-block;">Div</div> <input style="border:solid 1px gray; height:22px; line-height:22px; vertical-align:top;" type="text"> <button style="b
<div style="border:solid 1px gray; height:22px; line-height:22px; display:inline-block;">Div</div>
<input style="border:solid 1px gray; height:22px; line-height:22px; vertical-align:top;" type="text">
<button style="border:solid 1px gray; height:22px; line-height:22px; vertical-align:top;">Button</button>
Div
按钮
如您所见,为什么按钮元素1px比其他元素短?在Chrome和firefox中。这与浏览器为这些元素实现框模型的方式有关
div
和input
都使用内容框
,其中as按钮
使用边框框
有关更多信息,请参见此处:
您可以添加框大小:内容框代码>,-moz框大小:内容框代码>,-ms框大小:内容框代码>
强制CSS使用内容框方法计算维度
编辑--更多信息: