Blogger Information
Blog 8
fans 0
comment 0
visits 2456
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演示字体图标的引入与显示与媒体查询(移动优先)
alexcy的学习博客
Original
223 people have browsed it

1.实例演示字体图标的引入

  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. <link rel="stylesheet" href="./unicode.css">
  9. <link rel="stylesheet" href="class.css">
  10. <style>
  11. /* unicode */
  12. .iconfont.unicode {
  13. font-family: iconfont;
  14. }
  15. button {
  16. font-size: 2em;
  17. color: coral;
  18. transition: all .5s;
  19. }
  20. button:hover {
  21. font-size: 3em;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <!-- 1.unicode -->
  27. <button class="iconfont unicode">&#xe697;添加用户</button>
  28. <button class="iconfont icon-shezhitianchong">设置</button>
  29. </body>
  30. </html>

2.媒体查询

指令:@media 默认screen即屏幕
属性:max-width min-width
操作符:and not onlu
书写顺序约定
1、移动端:从小到大
2、PC端:从大到小

  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. </head>
  9. <body>
  10. <button class="btn sm">按钮1</button>
  11. <button class="btn md">按钮2</button>
  12. <button class="btn lg">按钮3</button>
  13. <style>
  14. html{
  15. font-size: 0.625rem;
  16. }
  17. .btn {
  18. background-color: coral;
  19. color: white;
  20. border: none;
  21. outline: none;
  22. }
  23. .btn:hover {
  24. cursor: pointer;
  25. opacity: .5;
  26. transition: all .3s;
  27. }
  28. .btn.sm {
  29. font-size: 1.2rem;
  30. }
  31. .btn.md {
  32. font-size: 1.6rem;
  33. }
  34. .btn.lg {
  35. font-size: 1.8rem;
  36. }
  37. /* 1.宽度小于375px,字号改为12px */
  38. @media (max-width: 375px) {
  39. html{
  40. font-size:12px;
  41. }
  42. }
  43. @media (min-width:600px) {
  44. html{
  45. font-size: 16px;
  46. }
  47. }
  48. @media (min-width:375px) and (max-width:600px) {
  49. html{
  50. font-size: 14px;
  51. }
  52. }
  53. </style>
  54. </body>
  55. </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