gpt4 book ai didi

html - 在父 div 中创建灵活的子 div

转载 作者:太空宇宙 更新时间:2023-11-04 11:50:36 25 4
gpt4 key购买 nike

这是我的三个 div。

<div class="header">
<div>@ViewBag.Title</div>
</div>
<div class="content">
</div>
<div class="footer">
</div>

这是我的 CSS。

<style type="text/css">
html, body
{
height: 100%;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
.header
{
height: 10%;
width: 100%;
background-color: whitesmoke;
text-align: center;
}
.content
{
height: 80%;
width: 100%;
background-color: white;
}
.footer
{
height: 10%;
width: 100%;
background-color: whitesmoke;
}
</style>

现在我希望我的父 Header div 中的子 div 是灵活的。每当我更改浏览器大小时,父标题 div 内的子 div 也会根据我的浏览器大小调整大小。并将留在标题 div 内。请帮忙。

最佳答案

.header div
{
height: 100%;
width: 100%;
}

将其用于子 div。

如果设置子 div 的宽度为 50%。它填充了父级的 50%。

关于html - 在父 div 中创建灵活的子 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30667453/

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