WEB前端 网页图标
2016-08-01 23:53
323 查看
本文是学习笔记,只是记录,并非原创。
网页图标的几种方式比较
css sprite
通过background-image和background-position进行切割
font&html
引入字体文件,利用css伪类添加图标 || 在标签中直接写图标编码
html&css
添加class进行添加图标
图标资源网站 icomoon.in
syj 2016.8.1
网页图标的几种方式比较
css sprite | font & html | font & css | |
---|---|---|---|
原理 | 背景图片定位 | @font-face | |
兼容性 | 支持 | 支持 | 低版本IE不支持 |
图标颜色 | 丰富 | 单一 | |
缩放 | 失真 | 不失真 | |
后期维护 | 困难 | 简单 |
通过background-image和background-position进行切割
font&html
引入字体文件,利用css伪类添加图标 || 在标签中直接写图标编码
@font-face { font-family: 'icomoon'; src: url('../fonts/icomoon.eot?lyboi0');/*兼容IE9*/ src: url('../fonts/icomoon.eot?lyboi0#iefix') format('embedded-opentype'),/*?#iefix解决IE6-8图标无法显示问题*/ url('../fonts/icomoon.ttf?lyboi0') format('truetype'), url('../fonts/icomoon.woff?lyboi0') format('woff'), url('../fonts/icomoon.svg?lyboi0#icomoon') format('svg'); font-weight: normal; font-style: normal; } .icon { /* use !important to prevent issues with browser extensions that change fonts */ font-family: 'icomoon' !important; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .icon:before{ content:'\图标代码'; } <span class="icon"></span>
html&css
添加class进行添加图标
@font-face { font-family: 'icomoon'; src: url('../fonts/icomoon.eot?lyboi0'); src: url('../fonts/icomoon.eot?lyboi0#iefix') format('embedded-opentype'), url('../fonts/icomoon.ttf?lyboi0') format('truetype'), url('../fonts/icomoon.woff?lyboi0') format('woff'), url('../fonts/icomoon.svg?lyboi0#icomoon') format('svg'); font-weight: normal; font-style: normal; } .icon { /* use !important to prevent issues with browser extensions that change fonts */ font-family: 'icomoon' !important; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .icon-heart:before { content: "\e900"; } <div class="col-md-2"> <span class="icon icon-truck"></span> </div>
图标资源网站 icomoon.in
syj 2016.8.1
相关文章推荐
- [下载]web前端网页设计必备:最新50套免费高质量icon图标集
- Web前端开发:DIV+CSS网页布局总结
- Aresio Web 2.0网页UI图标素材分享下载[微盘地址]
- web前端如何让网页布局稳定性和标准性?
- 2014网页WEB前端设计趋势预测
- 【原】PSD图标素材的全自动切图方法,适用于IOS、安卓、web前端等领域
- web前端实验二:利用JS保护网页源代码
- web前端网页开发一般过程
- Web前端:QtWebkit操作网页的几种方法
- WEB前端网页设计全集视频教程【54讲】 WEB前端实战视频教程
- 分享下载 23 款简单常用的web前端jquery网页特效
- Web前端之网页导航----手把手教你做导航(图,代码)
- web的各种前端打印方法之jquery打印插件PrintArea实现网页打印
- Web前端之网页导航----创新工场
- web前端网页开发一般过程
- 精选推荐 23 款基于jquery的web前端网页特效
- Web前端之网页导航----豌豆荚
- Web前端之网页导航----126邮箱(关于position)
- web的各种前端打印方法之jquery打印插件jqprint实现网页打印(转载)
- web网页前端制作中的SEO方法