博客列表 >字体图标的引用及媒体查询

字体图标的引用及媒体查询

白鸽
白鸽原创
2022年10月26日 14:02:21795浏览

字体图标的引用及媒体查询

媒体查询由小屏幕到大屏幕查询效果如下。
1
2

" class="reference-link">3

html代码如下

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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>字体图标及媒体查询</title>
  8. <style>
  9. html{
  10. font-size: 64px;
  11. }
  12. /* 体验使用下载图标的方式,先引用下载图标的字体文件 */
  13. @font-face {
  14. font-family: "iconfont";
  15. src: url('iconfont.woff2') format('woff2'),
  16. url('iconfont.woff') format('woff'),
  17. url('iconfont.ttf') format('truetype');
  18. }
  19. .iconfont {
  20. font-family: "iconfont" !important;
  21. font-size: 1rem;
  22. font-style: normal;
  23. -webkit-font-smoothing: antialiased;
  24. -moz-osx-font-smoothing: grayscale;
  25. }
  26. .icon-tuichudenglu:before {
  27. content: "\e6cf";
  28. }
  29. .icon-shezhi:before {
  30. content: "\e6d8";
  31. }
  32. .icon-shouye:before {
  33. content: "\e6fa";
  34. }
  35. .icon-wode:before {
  36. content: "\e6fb";
  37. }
  38. /* 字体文件设置引入完毕 */
  39. @media (max-width: 374px) {
  40. html {
  41. font-size: 16px;
  42. }
  43. }
  44. @media (min-width: 375px) and (max-width: 768px) {
  45. html {
  46. font-size: 32px;
  47. }
  48. }
  49. @media (min-width: 768px) {
  50. html {
  51. font-size: 64px;
  52. }
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <div>
  58. <p><span class="iconfont icon-shouye"></span>&nbsp;&nbsp;&nbsp;&nbsp;
  59. <span class="iconfont icon-tuichudenglu"></span>&nbsp;&nbsp;&nbsp;&nbsp;
  60. <span class="iconfont icon-shezhi"></span>&nbsp;&nbsp;&nbsp;&nbsp;
  61. <span class="iconfont icon-wode"></span></p>
  62. </div>
  63. </body>
  64. </html>
上一条:1025作业下一条:1019 +实现 小后台
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议