码迷,mamicode.com
首页 > 其他好文 > 详细

9.求背景图片左边到#box盒子左边外框侧的距离

时间:2018-10-29 11:18:28      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:oct   图片   距离   pre   背景图片   答案   type   back   ext   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>求背景图片左边到#box盒子左边外框侧的距离</title>

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

        #box{
            width: 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; /* 左右 上下*/
           /*  background-position 和margin (上下 ; 左右) 等不一样*/
        }

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

 

9.求背景图片左边到#box盒子左边外框侧的距离

标签:oct   图片   距离   pre   背景图片   答案   type   back   ext   

原文地址:https://www.cnblogs.com/FlyingLiao/p/9869288.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!