<!DOCTYPE html>
<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>
/* 屏幕的大小满足:>=540px且<=750px,页面背景颜色蓝色
>750px且<970px,背景颜色为绿色
>=970px,颜色为红色 */
/* 媒体查询
min-width和max-width计算时包含等于情况 */
@media screen and (min-width:540px) and (max-width:750px){
body{
background-color: #00f;
}
}
@media screen and (min-width:751px) and (max-width:969px){
body{
background-color: #0f0;
}
}
@media screen and (min-width:970px){ /* 中间要有空格!!! */
body{
background-color: #f00;
}
}
</style>
</head>
<body>
</body>
</html>