icon图标引入和css自适应终端
html代码
<body>
<div>
<span class="iconfont icon-all all"></span>
<span class="iconfont icon-pay-jingdong jingdong"></span>
<span class="iconfont icon-rising rising"></span>
</div>
</body>
css代码
@import 'icon/iconfont.css';
.jingdong{
color: red;
font-size: 2rem;
}
.all{
color: blue;
font-size: 2rem;
}
.rising{
color: green;
font-size: 2rem;
}
效果截图演示
css自适应屏幕宽度从大到小
html代码
<body>
<div>
<span class="iconfont icon-all all">1</span>
<span class="iconfont icon-pay-jingdong jingdong">2</span>
<span class="iconfont icon-rising rising">3</span>
</div>
</body>
css代码
@import 'icon/iconfont.css';
html {
font-size: 16px;
}
.jingdong{
color: red;
font-size: 2rem;
}
.all{
color: blue;
font-size: 2rem;
}
.rising{
color: green;
font-size: 2rem;
}
@media (min-width:1001px) and (max-width:9999px) {
html {
font-size: 99px;
}
}
@media (max-width:1000px) {
html {
font-size: 90px;
}
}
@media (max-width:800px) {
html {
font-size: 63px;
}
}
@media (max-width:600px) {
html {
font-size:54px ;
}
}
@media (max-width:450px) {
html {
font-size: 45px;
}
}
@media (max-width:350px) {
html {
font-size: 27px;
}
}
效果截图演示
1000px宽
800px宽
600px宽
450px宽
350px宽