博主信息
博文 8
粉丝 0
评论 0
访问量 4795
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
实例演示字体图标的引入与显示与媒体查询(移动优先)
alexcy的学习博客
原创
445人浏览过

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>
批改老师: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+教程免费学