搜索
博主信息
博文 62
粉丝 3
评论 1
访问量 41335
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
阿里字体图标使用写法与响应式代码
kiraseo_wwwkiraercom
原创
705人浏览过

引入阿里图标

案例代码

  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. <title>字体图标使用</title>
  8. <link rel="stylesheet" href="css/zuoye1.css">
  9. </head>
  10. <body>
  11. <!--使用大尺寸font-size-b-->
  12. <span class="iconfont icon-icon-wangluo font-size-b">111</span>
  13. <!--使用小尺寸font-size-s-->
  14. <span class="iconfont icon-icon-wangluo font-size-s">111</span>
  15. </body>
  16. </html>
  1. <--zuoye1.css-->
  2. //引入字体库文件的css
  3. @import url('font_icon/iconfont.css');
  4. //自定义尺寸
  5. //大尺寸
  6. .font-size-b{
  7. font-size: 35px;
  8. color: red;
  9. }
  10. //小尺寸
  11. .font-size-s{
  12. font-size: 10px;
  13. color: red;
  14. }

效果图

效果图

响应式代码

案例代码

  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. <title>媒体查询</title>
  8. <link rel="stylesheet" href="css/zuoye.css">
  9. </head>
  10. <body>
  11. <button class="btn small">btn1</button>
  12. <button class="btn middle">btn2</button>
  13. <button class="btn large">btn3</button>
  14. </body>
  15. </html>
  1. <--zuoye.css-->
  2. html{font-size: 10px;}
  3. .btn{outline: none;border: none;color: white;background-color: seagreen;}
  4. .small{ font-size: 1.2rem;}
  5. .middle{font-size: 1.6rem;}
  6. .large{font-size: 2rem;}
  7. /* 大屏幕 :大于等于1200px*/
  8. @media (min-width: 1200px) {
  9. html{ font-size: 80px;}
  10. }
  11. /*默认*/
  12. @media (min-width: 980px){
  13. html{font-size: 60px; }
  14. }
  15. /* 平板电脑和小屏电脑之间的分辨率 */
  16. @media (min-width: 768px) and (max-width: 979px) {
  17. html{ font-size: 50px; }
  18. }
  19. /* 横向放置的手机和竖向放置的平板之间的分辨率 */
  20. @media (max-width: 767px) {
  21. html{font-size: 40px;}
  22. }
  23. /* 横向放置的手机及分辨率更小的设备 */
  24. @media (max-width: 480px) {
  25. html{font-size: 30px;}
  26. }

效果图

效果图

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