07. 背景图片距离

背景图片距离

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        #box{
             100px;
            height: 200px;
            background: pink;
            padding: 100px;
            border: 80px solid blue;
            background-image: url("img/1.png");
            background-repeat: no-repeat;
            background-origin: content-box;
            background-position: -50px 0;
        }

        /*答案:130px*/
    </style>
</head>
<body>
<div id="box"></div>
</body>
</html>

  

原文地址:https://www.cnblogs.com/Lolita-web/p/10457745.html