响应式布局
<!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>
*{
margin: 0;
padding: 0;
}
html,body{
height: 100%;
}
/* 大于1000是黄色 */
@media screen and (min-width:1000px) {
body{
background: yellow;
}
}
/* 500-1000之间是红色 */
@media screen and (max-width:1000px) and (min-width:500px) {
body{
background: red;
}
}
/* 0-500都是绿色 */
@media screen and (max-width:500px) {
body{
background: green;
}
}
</style>
</head>
<body>
</body>
</html>
滑动这里大于1000是黄色,500-1000是红色,0-500是绿色