Blogger Information
Blog 17
fans 0
comment 0
visits 6185
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
字体图标及媒体查询
生活需要加油
Original
508 people have browsed it

字体图标及媒体查询

1. 字体图标的引入与显示

font-icon-unicode.css

  1. @font-face {
  2. font-family: "iconfont"; /* Project id 3886259 */
  3. src: url("//at.alicdn.com/t/c/font_3886259_rduojctudo.woff2?t=1675848609007")
  4. format("woff2"),
  5. url("//at.alicdn.com/t/c/font_3886259_rduojctudo.woff?t=1675848609007")
  6. format("woff"),
  7. url("//at.alicdn.com/t/c/font_3886259_rduojctudo.ttf?t=1675848609007")
  8. format("truetype");
  9. }
  10. .dhw-font {
  11. font-family: iconfont;
  12. font-size: 5em;
  13. color: blue;
  14. }

font-icon-class.css

  1. @import url(//at.alicdn.com/t/c/font_3886259_rduojctudo.css);
  2. .active {
  3. font-size: 5em;
  4. color: cyan;
  5. }
  6. .active:hover {
  7. font-size: 6em;
  8. cursor: pointer;
  9. opacity: 0.2;
  10. transition: 0.6s;
  11. }

html

  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. <link rel="stylesheet" href="css/icon-font-unicode.css" />
  8. <link rel="stylesheet" href="css/font-icon-class.css" />
  9. <title>字体图标</title>
  10. </head>
  11. <body>
  12. <!-- 1.unicode -->
  13. <div class="dhw-font">
  14. <span>&#xe635;</span>
  15. </div>
  16. <hr />
  17. <div class="iconfont">
  18. <span class="icon-shejishi2 active"></span>
  19. </div>
  20. </body>
  21. </html>

网页效果
iconfont

2. 媒体查询(移动优先)

  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. </head>
  9. <body>
  10. <button class="btn small">小宝</button>
  11. <button class="btn middle">二宝</button>
  12. <button class="btn large">大宝</button>
  13. <style>
  14. html {
  15. /* 设置1rem=10px */
  16. font-size: 0.625rem;
  17. }
  18. .btn {
  19. background-color: cyan;
  20. color: white;
  21. border: none;
  22. outline: none;
  23. }
  24. .btn:hover {
  25. cursor: pointer;
  26. opacity: 0.2;
  27. transition: 0.3s;
  28. }
  29. .btn.small {
  30. font-size: 1.5rem;
  31. }
  32. .btn.middle {
  33. font-size: 2rem;
  34. }
  35. .btn.large {
  36. font-size: 2.5rem;
  37. }
  38. @media (max-width: 375px) {
  39. html {
  40. font-size: 12px;
  41. }
  42. }
  43. @media (min-width: 375px) and (max-width: 600px) {
  44. html {
  45. font-size: 16px;
  46. }
  47. }
  48. @media (min-width: 600px) {
  49. html {
  50. font-size: 18px;
  51. }
  52. }
  53. </style>
  54. </body>
  55. </html>

网页效果
mediaquery

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!