<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
input{
padding:0;
}
div{
height:40px;
font-size:0;
}
#text{
width:100px;
height:40px;
border:1px solid black;
}
#btn{
width:60px;
height:40px;
line-height:40px;
text-align:center;
background:red;
border:1px solid black;
}
</style>
</head>
<body>
<div>
<input type="text" id="text" />
<input type="button" id="btn" value="按钮"/>
</div>
</body>
</html>
做出来是这样的,我在chrome跟firefox弄过都这样,
差别的原因是
box-sizing
,button默认的是box-sizing: border-box;