gpt4 book ai didi

html - 将 flex 容器拆分为等宽部分

转载 作者:行者123 更新时间:2023-11-28 10:35:36 24 4
gpt4 key购买 nike

我正在尝试将内容 2 拆分为 2 个等宽的 div,以填充整个内容 2 的高度,但未能成功。怎么可能实现?

笨蛋:Click here

<ion-view title="Welcome">
<ion-content has-header="true" style="display: flex; flex-flow: column;">
<div style="height: 100%">
<div style="background-color: red;">
Content 1 (height based on content)
</div>
<div style="background-color: blue; flex: 2;">
<div style="display: inline-block;">
<div style="width: 50%; height: 100%; background: gray;">
Content 2(part 1)
</div>
<div style="width: 50%; height: 100%; background: tomato;">
Content 2(part 2)
</div>
</div>
</div>
<div>
<img style="width: 100%;" src="http://dummyimage.com/600x400/000/fff" />
</div>
</div>
</ion-content>
</ion-view>

enter image description here

最佳答案

<ion-content scroll="false" has-header="true" style="display: flex; flex-flow: column;height:100vh; ">
<div style="background-color: red;">
Content 1 (height based on content)
</div>
<div style="background-color: blue; display:flex;flex-direction:row;height:100vh;">
<div style="flex:1;hight:100vh;">
content 2 part 1
</div>
<div style="flex:1;">
Content 2 part 2
</div>


</div>
<div>
<img style="width: 100%;" src="http://dummyimage.com/600x400/000/fff" />
</div>
</ion-content>

关于html - 将 flex 容器拆分为等宽部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37872831/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com