Blogger Information
Blog 7
fans 0
comment 0
visits 2302
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
引用字体图标实例、媒体查询
阿辉
Original
347 people have browsed it

引用阿里字体图标实例

1.Unicode方式

  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. <!--1. Unicode导入方式,也可以创建一个css引用,link加载即可 -->
  10. <style>
  11. /* CDN 服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
  12. @font-face {
  13. font-family: "iconfont"; /* Project id 3886249 */
  14. src: url("//at.alicdn.com/t/c/font_3886249_n99lmnr433.woff2?t=1675846400709")format("woff2"),
  15. url("//at.alicdn.com/t/c/font_3886249_n99lmnr433.woff?t=1675846400709")format("woff"),
  16. url("//at.alicdn.com/t/c/font_3886249_n99lmnr433.ttf?t=1675846400709")format("truetype");
  17. }
  18. .icon {
  19. font-family: iconfont;
  20. font-size: 15px;
  21. color: blue;
  22. border: 1px solid ;
  23. width: 200px;
  24. }
  25. </style>
  26. <body>
  27. <!-- Unicode示例 -->
  28. <div class="icon">
  29. <p>&#xe623;用户</p>
  30. <p>&#xe689;密码</p>
  31. <p>&#xe60b;邮箱</p>
  32. </div>
  33. </body>
  34. </html>

2.class方式

  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>Document</title>
  8. <!-- 阿里字体图标引入 -->
  9. <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3886249_n99lmnr433.css">
  10. </head>
  11. <body>
  12. <!-- 2.class导入方式 -->
  13. <div class="iconfont">
  14. <span class="icon-yonghu-yuan user">用户</span>
  15. <span class="icon-mima psw">密码</span>
  16. <span class="icon-gongsiyouxiang email">邮箱</span>
  17. </div>
  18. <!-- 自定义修改图标样式示例 -->
  19. <style>
  20. .user {
  21. color: red;
  22. font-size: 20px;
  23. }
  24. .psw {
  25. color: blue;
  26. font-size: 25px;
  27. }
  28. .email {
  29. color: violet;
  30. font-size: 30px;
  31. }
  32. </style>
  33. </body>
  34. </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. </head>
  9. <style>
  10. /* 设置根字号1rem=10xp */
  11. html {
  12. font-size: 0.625rem;
  13. }
  14. .media {
  15. /* 设置文本颜色蓝色 */
  16. color: blue;
  17. /* 设置边框 */
  18. border: 1px solid;
  19. }
  20. /* 设置鼠标悬浮修改文本颜色红色,鼠标状态修改手指 */
  21. .media:hover {
  22. color: red;
  23. cursor: pointer;
  24. transition: 0.3s;
  25. }
  26. .media.x {
  27. /* 设置文字大小12px */
  28. font-size: 1.2rem;
  29. }
  30. .media.z {
  31. /* 设置文字大小16px */
  32. font-size: 1.6rem;
  33. }
  34. .media.d {
  35. /* 设置文字大小18px */
  36. font-size: 1.8rem;
  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: 14px;
  46. }
  47. }
  48. @media (min-width: 600px) {
  49. html {
  50. font-size: 16px;
  51. }
  52. }
  53. </style>
  54. <body>
  55. <p class="media x">小号</p>
  56. <p class="media z">中号</p>
  57. <p class="media d">大号</p>
  58. </body>
  59. </html>

总结

1.学习到字体图标导入方法,设置图标
2.网页的自适应方式,媒体查询

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