页面中图标的使用
之前说要整理这块内容,分享给大家,工作原因,直到现在,赶上清明宅在家里,赶紧整理出来与大家分享。
1 background-image: url(".../*.png");2 background-position: 0px 0px;3 4 /* 注意:position的负值情况。 */
1 <li><a href=""><i class="i-icon">﨡i>a>li>2
1 @font-face{ 2 font-family: "my-icon" 3 src: url("../*.eot"); 4 /* ie低版本浏览器需要加'?' 否则可能回报404错误 */ 5 src: url("../ *.eot?") format("embedded-opentype") 6 ,url("../ *.woff") format("woff") 7 ,url("../ *.ttf") format("truetype") 8 ,url("../ *.svg") format("svg"); 9 font-weight: normal;10 font-style: normal;11 }12 .i-icon{13 font-family: "my-icon";14 font-style: normal;15 font-weight: normal;16 font-size: 26px;17 -webkit-font-smoothing: antialiased; /*消除锯齿*/18 -moz-osx-font-smoothing: grayscale; /*消除锯齿*/19 }
1 <li><i class="icon icon-magic">i>li>2 @font-face { font-family: "myfont"; src: url("../ *.eot"); src: url("../ *.eot?#iefix") format("embedded-opentype"), url("../ *.woff") format("woff"), url("../ *.ttf") format("truetype"), url("../ *.svg") format("svg"); font-weight: normal; font-style: normal; } .icon { font-family: "myfont"; font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .icon-magic:before { content: "/c210"; }
各种方式对比
|