Blogger Information
Blog 35
fans 0
comment 0
visits 16760
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例:字体图标的使用,媒体查询的例子
手机用户311660634
Original
586 people have browsed it

<!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>

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