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

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

P粉116103988
P粉116103988原创
2022年07月09日 21:50:35445浏览

字体图标的引用

  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>字体图标</title>
  8. <link rel="stylesheet" href="./font_icon/iconfont.css">
  9. </head>
  10. <style>
  11. .icon span:first-of-type{
  12. color: red;
  13. }
  14. .icon span:nth-of-type(2){
  15. color:brown;
  16. font-size: 2em;
  17. }
  18. .icon span:last-of-type{
  19. font-size: 3em;
  20. }
  21. </style>
  22. <body>
  23. <div class="icon">
  24. <h1>字体图标</h1>
  25. 第一个京东图标:<span class="iconfont icon-jingdong"></span>
  26. <br>
  27. 第二个京东图标:<span class="iconfont icon-jingdong1"></span>
  28. <br>
  29. 第三个京东图标:<span class="iconfont icon-jingdong"></span>
  30. </div>
  31. </body>
  32. </html>

效果图如下:

媒体查询

PC端优先

  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. </head>
  9. <style>
  10. *{
  11. margin: 0;
  12. padding: 0;
  13. box-sizing: border-box;
  14. }
  15. html{
  16. font-size: 10px;
  17. }
  18. button{
  19. background-color: blue;
  20. color: aliceblue;
  21. border: none;
  22. }
  23. button:hover{
  24. background: red;
  25. cursor: pointer;
  26. }
  27. .text1{
  28. font-size: 1.5rem;
  29. }
  30. .text2{
  31. font-size:2rem;
  32. }
  33. .text3{
  34. font-size:3rem;
  35. }
  36. @media(min-width:2560px){
  37. html{
  38. font-size: 26px;
  39. }
  40. }
  41. @media(min-width:1920px) and (max-width:2560px){
  42. html{
  43. font-size:24px;
  44. }
  45. }
  46. @media(min-width:1680px) and (max-width:1920px){
  47. html{
  48. font-size:22px;
  49. }
  50. }
  51. @media(min-width:1600px) and (max-width:1680px){
  52. html{
  53. font-size:20px;
  54. }
  55. }
  56. @media(min-width:1440px) and (max-width:1600px){
  57. html{
  58. font-size:18px;
  59. }
  60. }
  61. @media(min-width:1366px) and (max-width:1440px){
  62. html{
  63. font-size:16px;
  64. }
  65. }
  66. @media (min-width: 600px) and (max-width:1366px){
  67. html {
  68. font-size: 16px;
  69. }
  70. }
  71. @media (min-width: 414px) and (max-width:600px) {
  72. html {
  73. font-size: 14px;
  74. }
  75. }
  76. @media (min-width: 375px) and (max-width: 413px) {
  77. html {
  78. font-size: 12px;
  79. }
  80. }
  81. @media (max-width: 374px) {
  82. html {
  83. font-size: 10px;
  84. }
  85. }
  86. </style>
  87. <body>
  88. <button class="text1">bt1</button>
  89. <button class="text2">bt2</button>
  90. <button class="text3">bt3</button>
  91. </body>
  92. </html>

效果图如下:



声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议