Blogger Information
Blog 37
fans 0
comment 0
visits 14293
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1. 实例演示使用class方式引入字体图标,以及自定义样式 2. 实例演示媒体查询(PC优先模式)
秋闲独醉
Original
348 people have browsed it

实例演示使用class方式引入字体图标,以及自定义样式

  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. <!-- 引入css样式表 -->
  8. <link rel="stylesheet" href="demo.css" />
  9. <title>引入字体图标</title>
  10. </head>
  11. <body>
  12. <iframe frameborder="1" name="content"></iframe>
  13. <div>
  14. <a href="www.baidu.com" target="content"><span class="iconfont icon-shouye"></span></a>
  15. <span class="iconfont icon-fenlei"></span>
  16. <span class="iconfont icon-icon03"></span>
  17. </div>
  18. </body>
  19. </html>
  1. /* 引入第三方字体 */
  2. @import url("font_icon/iconfont.css");
  3. * {
  4. margin: 0;
  5. padding: 0;
  6. }
  7. html {
  8. /* 设置根的字体大小 */
  9. font-size: 10px;
  10. }
  11. div .iconfont {
  12. /* 3rem,指的是根字体大小的3倍 */
  13. font-size: 3rem;
  14. margin: 3rem;
  15. }
  16. div {
  17. margin: 1rem;
  18. }

字体图标效果图

实例演示媒体查询(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>实例演示媒体查询(PC优先模式)</title>
  8. <style>
  9. /* 设置根原素字体大小为5px */
  10. html {
  11. font-size: 5px;
  12. }
  13. button.btn:hover {
  14. cursor: pointer;
  15. opacity: 0.7;
  16. transition: 0.8s;
  17. }
  18. body > button:nth-of-type(1) {
  19. font-size: 1rem;
  20. }
  21. body > button:nth-of-type(2) {
  22. font-size: 1.5rem;
  23. }
  24. body > button:last-of-type {
  25. font-size: 2rem;
  26. }
  27. /* 2. PC优先: 先从最大屏的设备进行适配 */
  28. /* 1000, 800 600 450 350 */
  29. @media (min-width: 1000px) {
  30. html {
  31. font-size: 25px;
  32. }
  33. }
  34. @media (max-width: 999px) and (min-width: 800px) {
  35. html {
  36. font-size: 20px;
  37. }
  38. }
  39. @media (max-width: 799px) and (min-width: 600px) {
  40. html {
  41. font-size: 15px;
  42. }
  43. }
  44. @media (max-width: 599px) and (min-width: 450px) {
  45. html {
  46. font-size: 10px;
  47. }
  48. }
  49. @media (max-width: 449px) and (min-width: 350px) {
  50. html {
  51. font-size: 5px;
  52. }
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <button class="btn">button1</button>
  58. <button class="btn">button2</button>
  59. <button class="btn">button3</button>
  60. </body>
  61. </html>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post