<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 300px;
height: 300px;
background-color: red;
}
@media screen and (max-width:768px){
.box{
background-color: aqua;
}
.p1{
display: none;
}
.p2{
display: none;
}
}
@media screen and (min-width:768px) and (max-width:996px){
.box{
background-color:chartreuse;
}
.p1{
display: block;
}
.p2{
display: none;
}
}
@media screen and (min-width:996px) {
.box{
background-color:red;
}
.p1{
display: block;
}
.p2{
display: block;
}
}
</style>
</head>
<body>
<div class="box"></div>
<p class="p1">哈哈哈</p>
<p class="p2">嗷嗷嗷</p>
</body>
</html>
多多关照不迷路哟!!!
谢谢