abstract:<!DOCTYPE html><html> <head> <meta charset="utf-8"> <style>div {width: 17px;height: 13px;back
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
div {
width: 17px;
height: 13px;
background: url(images/jd.png) no-repeat;
background-position: 0 -388px; /* 因为背景图片往上移动,所以是负值 */
margin: 100px auto;
}
p {
width: 56px;
height: 49px;
background: url(images/jd.png) no-repeat;
background-position: 0 -438px; /* 因为背景图片往上移动,所以是负值 */
}
</style>
</head>
<body>
<!-- 1. 插入图片 margin padding float position 移动图片 大小就是width
2. 背景图片 background 来控制 size大小 background-position 位置 -->
<div>
</div>
<p></p>
</body>
</html>
Correcting teacher:天蓬老师Correction time:2019-06-29 13:02:12
Teacher's summary:背景设置在前端中是一个非常有趣的知识, 使用得当,可以为你的项目增色