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.
 
 
 
 
 

51 lines
1.1 KiB

<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 {
display: flex;
}
#div0 div:first-child {
background-color: aqua;
flex: 0 0 50px
}
#div0 div:nth-child(2) {
background-color: blue;
flex: 1 1 auto
}
#div0 div:last-child {
background-color: red;
flex: 0 0 50px
}
/* 媒体查询 */
@media (min-device-width: 400px) and (max-device-width: 500px) {
#div0 div:nth-child(2) {
background-color: yellowgreen;
}
}
@media (min-device-width: 501px) and (max-device-width: 600px) {
#div0 div:nth-child(2) {
background-color: pink;
}
}
</style>
</head>
<body>
<div id="div0">
<div>one</div>
<div>two</div>
<div>three</div>
</div>
</body>
</html>