【发布时间】:2021-07-25 12:25:27
【问题描述】:
我在下面制作了一个我正在尝试创建的快速线框图。 我只是想将 childDiv 左侧的 25% 突出显示为绿色,将右侧的 65% 突出显示为红色。
我想建立正确的空间,让左 childInnerDiv 为绿色,右 childInnerDiv 为红色。但这似乎不起作用...
我有什么:
JsFiddle:http://jsfiddle.net/8vhgq6k3/
HTML 代码
<div class="ProjectsParentDiv">
<div class="childDiv">
Foo
<div class="childInnerDiv left">
</div>
<div class="childInnerDiv right">
</div>
</div>
<div class="childDiv">
Bar
</div>
<div class="childDiv">
Baz
</div>
</div>
CSS 代码
.ProjectsParentDiv {
// position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: max-width;
height: 40%;
border: 1px solid black;
}
.childDiv {
display: flex;
background-color: lightblue;
width: 75%;
height: 150px;
margin: 5px auto;
}
.childInnerDiv {
//trying to make the childInnerDiv to be 95% height & width. of the ChildDiv
height: 95%;
width: 95%;
}
.childInnerDiv.left {
flex: 25; //25% of the left side is a div for image.
background: green;
border: 1px solid yellow;
}
.childInnerDiv.right {
flex: 65; //65% of right side is a div for description
background: red;
border: 1px solid silver;
}
【问题讨论】: