You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
789 B

<html lang="en">
<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>
<style>
#div0 {
width: 100px;
height: 200px;
}
/* 根据不同的尺寸应用不同的效果 */
/* screen 是指屏幕, min-device-width 为屏幕最小尺寸,max-device-width 为屏幕最大尺寸 */
@media screen and (min-device-width: 200px) and (max-device-width: 300px) {
#div0 {
background-color: aqua;
}
}
@media screen and (min-device-width: 301px) and (max-device-width: 2000px) {
#div0 {
background-color: red;
}
}
</style>
</head>
<body>
<div id="div0"></div>
</body>
</html>