这个属性官方文档语法:

实例代码:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            .a{
                float: left;
                height: 200px;width: 200px;
                border: 10px dashed royalblue;
                padding: 20px;
                background-color: #008000;
             background: url(img/HBuilder.png) no-repeat;
             background-origin:padding-box;
            }
                        .b{
                float: left;
                height: 200px;width: 200px;
                border: 10px dashed royalblue;
                padding: 20px;
                background-color: #008000;
             background: url(img/HBuilder.png) no-repeat;
             background-origin:border-box;
            }
                        .c{
                float: left;
                height: 200px;width: 200px;
                border: 10px dashed royalblue;
                padding: 20px;
                background-color: #008000;
             background: url(img/HBuilder.png) no-repeat;
             
            }
                        .d{
                float: left;
                height: 200px;width: 200px;
                border: 10px dashed royalblue;
                padding: 20px;
                background-color: #008000;
             background: url(img/HBuilder.png) no-repeat;         
            }
        </style>
    </head>
    <body>
        <div class="a">padding</div>
        <div class="b">border</div>
        <div class="c">content</div>
        <div class="d">默认=padding</div>
    </body>
</html>

运行结果:


Care豆儿
2 声望0 粉丝

CL