<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>animate</title> <style> i{ display: inline-block;width: 8px;height: 7px;background: url(images/public-24.png) no-repeat -99px 3px;} </style> </head> <body> <i></i> </body> </html>
思路:i/s/b/div等等标签,设计其背景图片(即图标)如background: url(images/public-24.png) no-repeat -99px 3px。其中url(images/public-24.png) 表示图标集合路径、no-repeat不平铺、-99px 3px图标在图标集的位置,通过设置此坐标取得图标
注意:包含图标的标签如i(样式css 不设置display: inline-block;)可能会出图标无法显示。