我需要css样式的帮助。布局应如下所示。
>
我试过像这样
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 900px;
position: absolute;
}
.cell {
border: solid 3px black;
}
.cell-1 {
width: 1500px;
}
.cell-2 {
height: 450px;
width: 20%;
}
.cell-3 {
height: 450px;
width: 20%;
}
.big-container {
display: fixed;
flex-direction: row;
flex-wrap: wrap;
position: relative;
}
.container-2 {
display: inline-block;
flex-direction: column;
flex-wrap: wrap;
height: 100px;
position: absolute;
}
.container-3 {
display: flex;
flex-direction: column;
flex-wrap: wrap;
margin-top: 1300px;
height: 700px;
position: absolute;
}
.cell-2-1 {
margin-right: 300px;
margin-top: 1000px;
text-align: center;
width: 100%
}
.cell-2-2 {
width: 50%;
width:700px;
}
.cell-2-3 {
width: 50%;
margin-left: 200px;
}<div className="big-container">
<div className="container-1">
<div className="cell cell-1">
<Component1 /> (row2-left block)
</div>
<div className="cell cell-2">
<Component2 /> (row2-left block)
</div>
<div className="cell cell-3">
<Component3 /> (row2-right-side bottom block)
</div>
</div>
<div className="container-3">
<div className='cell-2-2'>
<Component5 /> (row4-left block)
</div>
<div className='cell-2-3'>
<Component6 /> (row4-right block)
</div>
</div>
</div>我以一种不正确的方式实现了它,比如根据到目前为止组件占用的空间,将.contain-3边距增加到1300 px。我想知道是否有更好更容易做到的
发布于 2022-08-04 05:30:08
我想你找这样的东西很难搞清楚,因为你没有提供预期的产出。
body{
padding: 0;
margin: 0;
height: 100vh;
Width: 100VW;
background:#333;
}
.big-container{
display:flex;
flex-direction:column;
}
.heading-row , .big-heading{
width:100%;
background-color:yellow;
}
.row1 , .row2{
height:400px;
display:flex;
}
.row1 .box1{
width:80%;
height:100%;
background:red;
}
.row1 .box2{
width:20%;
height:100%;
background:blue;
display:flex;
flex-direction:column;
}
.row1 .box2 > *{
height:50%;
width:100%;
}
.row1 .box2 .verticle-box1{
background-color:green;
}
.row1 .box2 .verticle-box2{
background-color:pink;
}
.row2 > *{
height:100%;
width:50%;
}
.row2 .box1{
background:orange;
}
.row2 .box2{
background:purple;
}<!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>
<body>
<div class="big-container">
<div class="heading-row">
<h1>Heading</h1>
</div>
<div class="row1">
<div class="box1"></div>
<div class="box2">
<div class="verticle-box1"></div>
<div class="verticle-box2"></div>
</div>
</div>
<div class="row2">
<div class="box1"></div>
<div class="box2"></div>
</div>
<div class="big-heading">
<h1>Heading</h1>
</div>
</div>
</body>
</html>
https://stackoverflow.com/questions/73229937
复制相似问题