目录
1.精灵图
1.1为什么需要精灵图
精灵技术目的:
为了有效地减少服务器接收和发送请求的次数,提高页面的加载速度。
1.2精灵图(sprites)的使用
1.3精灵图使用案例
参考代码:
<style>
div {
display: inline-block;
margin-left: 10px;
background-repeat: no-repeat;
background-image: url(../jpgs/精灵图.png);
}
.letter1 {
width: 110px;
height: 115px;
background-position: -491px -272px;
}
.letter2 {
width: 61px;
height: 113px;
background-position: -326px -136px;
}
.letter3 {
width: 123px;
height: 118px;
background-position: -249px -270px;
}
.letter4 {
width: 109px;
height: 116px;
background-position: -491px -141px;
}
</style>
</head>
<body>
<div class="letter1"></div>
<div class="letter2"></div>
<div class="letter3"></div>
<div class="letter4"></div>
</body>
2.字体图标
2.1字体图标的产生
2.2字体图标的优点
2.3字体图标的下载
2.4字体图标的引用(以icomoon为例)
第一步:
下载压缩文件后把fonts文件夹放在页面根目(建议把全部文件放在页面根目录下面,否则可能demo.html页面出错)
录下
font文件中的4个字体文件:
第二步:
字体文件引入到CSS样式中
以上样式可以在压缩文件中style.css记事文本中复制
第三步:
打开压缩文件中的demo.html复制想要的图标到html标签中
第四步: