CSS3 box-sizing的使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>box-sizing</title>
    <style>
        div {
            width: 200px;
            height: 200px
        }

        #div1 {
            background-color: red;
        }

        #div2 {
            background-color: yellow;
            padding:5px;
            border:5px solid blue;
            box-sizing: border-box; /*这个属性包含了border、padding*/
        }
    </style>
</head>
<body>
    <div id="div1">content</div>
    <div id="div2">content</div>
</body>
</html>

演示地址
http://xhope.top/samples/html/box-sizing.html