09.图标字体.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <link rel="stylesheet" href="./fa/css/all.css">
  9. <style>
  10. /*
  11. 通过伪元素来设置图标字体
  12. 1、找到要设置图标的元素,通过before或after选中
  13. 2、在content中设置字体的编码(在离线文档的右侧)
  14. 3、设置字体的样式
  15. -fab格式
  16. font-family:'Font Awesome 5 Brands'
  17. -fas格式
  18. font-family:'Font Awesome 5 Free';
  19. font-weight:900;
  20. */
  21. li{
  22. list-style: none;
  23. }
  24. li::before{
  25. content: '\f1b0';
  26. font-family: 'Font Awesome 5 Free';
  27. font-weight:900;
  28. color: blue;
  29. margin-right: 10px;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <!-- <i class="fas fa-cat"></i> -->
  35. <ul>
  36. <li>锄禾日当午</li>
  37. <li>汗滴禾下土</li>
  38. <li>谁知盘中餐</li>
  39. <li>粒粒皆辛苦</li>
  40. </ul>
  41. <!--
  42. 通过实体来使用图标字体:
  43. &#x图标的编码;
  44. -->
  45. <span class="fas">&#xf0f3;</span>
  46. </body>
  47. </html>