Blogger Information
Blog 28
fans 0
comment 0
visits 12973
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
图标使用(class)和媒体查询实例演示
手机用户1594223549
Original
624 people have browsed it

一.图标使用(class)

1.成果输出

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. <!-- Class -->
  9. <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3731673_a1qsilac6p.css">
  10. <style>
  11. .iconfont.class{
  12. font-size: x-large;
  13. color: green;
  14. text-shadow: 1px 1px 1px #888;
  15. }
  16. .iconfont.class:hover{
  17. color: red;
  18. cursor: pointer;
  19. transition: color 0.6s linear;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <!-- 1.class -->
  25. <div class="iconfont class">
  26. <div class="icon-zhuce"></div>
  27. <div class="icon-denglu"></div>
  28. </div>
  29. <hr />
  30. </body>
  31. </html>

二.媒体查询

1.成果输出

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. <!-- 1.媒体查询的原理 -->
  11. <!-- 媒体: 屏幕, 手机, 打印机
  12. 查询: 查询媒体宽度来确定元素展示方式
  13. 布局不能在一个无限空间进行,宽,高必须限定一个
  14. 默认限定宽高,而高度随内容不断增长 -->
  15. <button class="btn small">查询1</button>
  16. <button class="btn middle">查询2</button>
  17. <button class="btn large">查询3</button>
  18. <style>
  19. html{
  20. /* 1rem=10px */
  21. font-size: 10px;
  22. }
  23. .btn{
  24. background-color: green;
  25. color: red;
  26. border: none;
  27. outline: none;
  28. }
  29. .btn:hover{
  30. cursor: pointer;
  31. opacity: 0.5;
  32. transition: color 0.3s linear;
  33. }
  34. /* 查询1 */
  35. .btn.small{
  36. font-size: 1.4rem;
  37. }
  38. /* 查询2 */
  39. .btn.middle{
  40. font-size: 1.8rem;
  41. }
  42. /* 查询3 */
  43. .btn.large{
  44. font-size: 2.2rem;
  45. }
  46. /* 2.媒体查询的顺序 */
  47. /* 移动端: 从小往大写 */
  48. /* PC端: 反过来写,从大向下写 */
  49. /* < 375px , 1rem = 12px */
  50. /* 小于375px,意思就是不大于375px */
  51. @media (max-width: 374px) {
  52. html {
  53. font-size: 12px;
  54. }
  55. }
  56. /* 375px - 415px : 1rem = 14px */
  57. @media (min-width: 375px) and (max-width: 414px) {
  58. html {
  59. font-size: 14px;
  60. }
  61. }
  62. /* > 415px : 1rem = 16px */
  63. @media (min-width: 415px) {
  64. html {
  65. font-size: 16px;
  66. }
  67. }
  68. </style>
  69. </body>
  70. </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