博主信息
博文 35
粉丝 0
评论 0
访问量 30809
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
实例:字体图标的使用,媒体查询的例子
手机用户311660634
原创
820人浏览过

<!DOCTYPE html>

<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="//at.alicdn.com/t/c/font_3730320_ivn9suva91e.css">
</head>

<style>
/ CDN 服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 /
@font-face {
font-family: ‘iconfont’; / Project id 3730320 /
src: url(‘//at.alicdn.com/t/c/font_3730320_ivn9suva91e.woff2?t=1666763560453’) format(‘woff2’),
url(‘//at.alicdn.com/t/c/font_3730320_ivn9suva91e.woff?t=1666763560453’) format(‘woff’),
url(‘//at.alicdn.com/t/c/font_3730320_ivn9suva91e.ttf?t=1666763560453’) format(‘truetype’);
}

.iconfont.test {
/ 声明字体的名称 /
font-family: iconfont;
/ 声明其它字体属性 /
font-size: x-large;
color: pink;
/ 加阴影 /
text-shadow: 1px 1px 1px #888;
}

/ class 引用字体图标的用法 /
.iconfont.test2{
font-family: iconfont;
color:red;
font-size: x-large;

}

</style>

<body>
<div class="iconfont test">
<span></span>
</div>

  1. <div class="iconfont test2">
  2. <span class="icon-kefufill"></span>
  3. </div>

</body>

<body>
<button class="btn xiao">按钮1</button>
<button class="btn zhong">按钮2</button>
<button class="btn da">按钮3</button>
<style>
html {
font-size: 10px;
}
.btn {
background-color: red;
color: yellow;
border: none;
outline: none;
}
.btn:hover{
cursor: pointer;
opacity: 0.8;

  1. }
  2. .btn.xiao{
  3. font-size: 1.4rem;
  4. }
  5. .btn.zhong{
  6. font-size: 1.8rem;
  7. }
  8. .btn.da{
  9. font-size: 2.2rem;
  10. }
  11. /* 媒体查询的宽度顺序:
  12. 1. 移动端: 从小往大写
  13. 2. PC端: 反过来写,从大向下写 */
  14. /* 移动端媒体查询 */
  15. /* 当屏幕小于380px */
  16. @media (max-width:38rem){
  17. html{
  18. font-size: 20px;
  19. }
  20. }
  21. /* 380px - 420px */
  22. @media (min-width:38rem) and (max-width:42rem){
  23. html{
  24. font-size: 30px;
  25. }
  26. }
  27. /* 420px以上 */
  28. @media (min-width:42rem){
  29. html{
  30. font-size: 40px;
  31. }
  32. }
  33. </style>

</body>
</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+教程免费学