编程爱好者联盟 2016-11-25

默认 width 、height的 content-box 的宽高.
box-sizing 经常用来设置 width、height指定的区域
box-sizing 经常用做一些自适应的布局。
box-sizing:content-box | border-box
默认值:content-box
适用于:所有接受 <' width '> 和 <' height '> 的元素
继承性:无
动画性:否
计算值:指定值
设置或检索对象的盒模型组成模式。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>box-sizing</title>
<style type="text/css">
div{
width: 260px;
height: 260px;
padding: 30px;
background-color: pink;
border: 5px solid blue;
}
.sample0{
box-sizing: content-box;
}
.sample1{
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="sample0">
width: 260px;<br>
height: 260px;<br>
padding: 30px;<br>
background-color: pink;<br>
border: 5px solid blue;<br>
</div>
<br>
<div class="sample1">
width: 260px;<br>
height: 260px;<br>
padding: 30px;<br>
background-color: pink;<br>
border: 5px solid blue;<br>
</div>
</body>
</html>