height 属性设置元素的高度。
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>盒子尺寸的计算方法</title>
<style type="text/css">
div {
margin:5px;
width:200px;
height:80px;
background-color:#fe0;
border:10px solid #f90;
padding:10px;
font-weight:bold;
font-size:18px;
line-height:40px;
}
.s1 {
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
}
.s2 {
box-sizing:padding-box;
-webkit-box-sizing:padding-box;
-moz-box-sizing:padding-box;
}
.s3 {
box-sizing:content-box;
-webkit-box-sizing:content-box;
-moz-box-sizing:content-box;
}
</style>
</head>
<body>
<div class="s1">border-box</div>
<div class="s2">padding-box</div>
<div class="s3">content-box</div>
</body>
</html>
转载请注明原文地址:https://ipadbbs.8miu.com/read-41357.html