1.实例演示字体图标的引入
<!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="./unicode.css">
<link rel="stylesheet" href="class.css">
<style>
/* unicode */
.iconfont.unicode {
font-family: iconfont;
}
button {
font-size: 2em;
color: coral;
transition: all .5s;
}
button:hover {
font-size: 3em;
}
</style>
</head>
<body>
<!-- 1.unicode -->
<button class="iconfont unicode">添加用户</button>
<button class="iconfont icon-shezhitianchong">设置</button>
</body>
</html>
2.媒体查询
指令:@media 默认screen即屏幕
属性:max-width min-width
操作符:and not onlu
书写顺序约定
1、移动端:从小到大
2、PC端:从大到小
<!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>
</head>
<body>
<button class="btn sm">按钮1</button>
<button class="btn md">按钮2</button>
<button class="btn lg">按钮3</button>
<style>
html{
font-size: 0.625rem;
}
.btn {
background-color: coral;
color: white;
border: none;
outline: none;
}
.btn:hover {
cursor: pointer;
opacity: .5;
transition: all .3s;
}
.btn.sm {
font-size: 1.2rem;
}
.btn.md {
font-size: 1.6rem;
}
.btn.lg {
font-size: 1.8rem;
}
/* 1.宽度小于375px,字号改为12px */
@media (max-width: 375px) {
html{
font-size:12px;
}
}
@media (min-width:600px) {
html{
font-size: 16px;
}
}
@media (min-width:375px) and (max-width:600px) {
html{
font-size: 14px;
}
}
</style>
</body>
</html>