博主信息
博文 49
粉丝 0
评论 3
访问量 33879
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
字体图标与媒体查询示例
P粉479712293
原创
537人浏览过

题目一:字体图标示例:

  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优先 */

效果图如下:

批改老师:PHPzPHPz

批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学