Blogger Information
Blog 49
fans 0
comment 3
visits 23237
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
字体图标与媒体查询示例
P粉479712293
Original
352 people have browsed it

题目一:字体图标示例:

  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="../static/icon_font/font_3316062_x29n1h5chbq/iconfont.css"> -->
  8. <link rel="stylesheet" href="../static/5-3.css">
  9. <title>字体图标</title>
  10. </head>
  11. <body>
  12. <div>
  13. <span class="iconfont icon-gouwuchekong"></span>
  14. </div>
  15. </body>
  16. </html>

对应的css文件为:

  1. @import "../static/icon_font/font_icon1/iconfont.css";
  2. .iconfont.icon-gouwuchekong{
  3. font-size: 17px;
  4. color: green;
  5. }

效果图如下:

题目二:媒体查询示例:

  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="../static/字体图标与媒体查询示例2.css">
  8. <title>媒体查询2</title>
  9. </head>
  10. <body>
  11. <button class="btn samll">btn1</button>
  12. <button class="btn middle">btn2</button>
  13. <button class="btn large">btn3</button>
  14. </body>
  15. </html>

对应的css文件如下:

  1. html{
  2. font-size: 10px;
  3. }
  4. .btn{
  5. background-color: green;
  6. color: white;
  7. border: none;
  8. outline: none;
  9. }
  10. .btn:hover{
  11. cursor: pointer;
  12. opacity: 0.8;
  13. transition: 0.5s;
  14. padding: 0.4rem 0.8rem;
  15. }
  16. .btn.small{
  17. font-size: 1.2rem;
  18. }
  19. .btn.middle{
  20. font-size: 1.6rem;
  21. }
  22. .btn.large{
  23. font-size: 1.8rem;
  24. }
  25. /* *当小于374时生效(使字体大一点) */
  26. @media(max-width:374px){
  27. html{
  28. font-size: 12px;
  29. }
  30. }
  31. /* *375-414px之间 */
  32. @media(min-width:375px)and(max-width:413px){
  33. html{
  34. font-size: 14px;
  35. }
  36. }
  37. /* *414px以上空间 */
  38. @media(min-width:414px){
  39. html{
  40. font-size: 16px;
  41. }
  42. }
  43. /* *以上是由小到大叫移动优先 */
  44. /* *如果是由大到小叫pc优先 */

效果图如下:

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