8.使用背景图,制作雪碧图效果

岁酱吖の 提交于 2020-04-11 09:30:21

使用背景图,制作雪碧图效果:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- reset.css文件内容参考:https://www.cnblogs.com/lanshanxiao/p/12663192.html -->
    <link rel="stylesheet" href="./reset.css">
    <style>
        .img{
            width:150px;
            height:150px;
            border:2px solid;
            background-image:url("https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=382503044,3585482793&fm=26&gp=0.jpg");
            background-repeat: no-repeat;
            background-position:-160px -80px;
        }
    </style>
</head>
<body>
    <div class="img">

    </div>
</body>

</html>
index.html

 

原图展示:

 

 

我们要从上面的图片中抠取出太阳来当做背景图片。

 

效果展示:

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!