a、从子项中设置的
<!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>
</head>
<style>
div {
display: flex;
width: 800px;
height: 600px;
background-color: pink;
}
div>:nth-child(1) {
width: 200px;
height: 600px;
background-color: blue;
}
div>:nth-child(2) {
flex: 2;
background-color: yellow;
}
div>:nth-child(3) {
flex: 2;
background-color: yellow;
}
</style>
<body>
<div>
<span></span>
<span>2</span>
<span>3</span>
</div>
</body>
</html>
b、从父项中设置
<!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>
</head>
<style>
* {
margin: 0;
padding: 0;
}
/* div {
display: flex;
width: 800px;
height: 600px;
background-color: pink;
}
div>:nth-child(1) {
width: 200px;
height: 600px;
background-color: blue;
}
div>:nth-child(2) {
flex: 2;
background-color: yellow;
}
div>:nth-child(3) {
flex: 2;
background-color: yellow;
} */
/* ---------------------------------------------- */
.one {
width: 1200px;
height: 400px;
background-color: pink;
}
.two {
float: right;
display: flex;
width: 600px;
height: 400px;
background: red;
justify-content: space-around;
}
</style>
<body>
<!-- <div>
<span></span>
<span>2</span>
<span>3</span>