【发布时间】:2021-07-10 03:17:46
【问题描述】:
【问题讨论】:
【问题讨论】:
您也应该在此处发布您的代码并告诉您的问题,因为有多种方法可以这样做。 这样做的一种方法是使用带有 flex-direction=row 和 2 个 flex-items 的主 flexbox:第一个 'First-div' 作为 th2 第二个带有 flex-direction=column 的 flexbox。 这是一个代码。希望对你有帮助
<!DOCTYPE html>
<html>
<head>
<style>
.flex-container {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
width: 400px;
height: 250px;
}
.flex-container2 {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
width: 400px;
height: 250px;
}
.flex-item-cont{
background-color: cornflowerblue;
width: 100px;
height: 100px;
margin: 0px;
}
.flex-item1 {
background-color: red;
width: 100px;
height: 200px;
margin: 0px;
}
.flex-item2 {
background-color: blue;
width: 100px;
height: 100px;
margin: 0px;
}
.flex-item3 {
background-color: green;
width: 100px;
height: 100px;
margin: 0px;
}
</style>
</head>
<body>
<div class="flex-container">
<div class="flex-item1">Third Div</div>
<div class="flex-item-cont">
<div class="flex-container2">
<div class="flex-item2">First Div</div>
<div class="flex-item3">Second Div</div>
</div>
</div>
</div>
</body>
</html>
希望,它会有所帮助。
【讨论】:
按照使用 flex 完成的代码,它会自动调整子框的大小
<style>
.box-main {
display: flex;
justify-contents: space-between;
}
.box1 {
height: 100vh;
background-color: red;
width: 40%;
}
.box2 {
width: 60%;
height: 100vh;
display: flex;
justify-content: space-evenly;
flex-direction: column;
}
.subbox1 {
background-color: blue;
flex: 1;
}
.subbox2 {
background-color: green;
flex: 1;
}
</style>
<div class="box-main">
<div class="box1">
Third Div
</div>
<div class="box2">
<div class="subbox1">
First Div
</div>
<div class="subbox2">
Second Div
</div>
</div>
</div>
【讨论】: