Blogger Information
Blog 28
fans 0
comment 0
visits 11643
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
10.25日作业
子墨吖ฅฅ
Original
695 people have browsed it

字体图标和媒体查询的使用

  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. </head>
  10. <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3730237_r72fopzdz8f.css">
  11. <!--引入外部图标库css-->
  12. <style>
  13. /*媒体查询*/
  14. .box{
  15. width: 200px;
  16. height: 200px;
  17. background-color: pink;
  18. }
  19. /*当移动端宽度小于300px时,改变div标签的背景颜色为蓝色*/
  20. @media (max-width: 300px) {
  21. .box{
  22. background-color: blue;
  23. }
  24. }
  25. /*当移动端宽度大于300px小于500px,改变div标签的背景颜色为红色*/
  26. @media (min-width: 301px) and (max-width: 500px){
  27. .box{
  28. background-color: red;
  29. }
  30. }
  31. </style>
  32. <body>
  33. <!--class方式引用购物车图标-->
  34. <span class="icon iconfont icon-gouwuchekong">购物车</span>
  35. <div class="box">媒体查询</div>
  36. </body>
  37. </html>

运行图

移动端宽度小于300px时

移动端宽度大于300px小于500px时

移动端宽度大于500px时(默认样式)

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