gpt4 book ai didi

html - div填充左边的空白高度

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

我有这个样本:

link

代码 HTML:

    <div id="wrap">

<div class="nav">
<ul>
<li>Link1</li>
<li>Link2</li>
<li>Link3</li>
<li>Link4</li>
</ul>
</div>
<div class="right">
asdasdsa
</div>

</div>

<footer>

</footer>

代码 CSS:

   #wrap{
float: none;
height: auto;
margin: 0 auto;
min-height: calc(100vh - 348px);
}
.nav{
float:left;
display:inline-block;
width:200px;
height:100%;
background:red;
}
.right{
background:blue;
width:calc(100% - 200px);
float:left
}

footer{
width:100%;
height:50px;
background:grey;
position:absolute;
bottom:0;
}

我想要做的是将左侧的 div 设置为页脚高度。

你能告诉我我的代码有什么问题吗?

Div(红色)基本上想成为页脚。我设法用 display: table 做到了这一点,但我想要另一个解决方案。

提前致谢!

最佳答案

这是更新的 fiddle .修改你的 .nav 代码如下

#wrap {
float: none;
height: auto;
margin: 0 auto;
min-height: calc(100vh - 348px);
}
.nav {
float: left;
display: inline-block;
width: 200px;
height: calc(100vh - 50px);
background: red;
position: absolute;
}
.right {
background: blue;
width: calc(100% - 200px);
float: left
}
footer {
width: 100%;
height: 50px;
background: grey;
position: absolute;
bottom: 0;
}
<div id="wrap">

<div class="nav">
<ul>
<li>Link1</li>
<li>Link2</li>
<li>Link3</li>
<li>Link4</li>
</ul>
</div>
<div class="right">
asdasdsa
</div>

</div>

<footer>

</footer>

关于html - div填充左边的空白高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36356450/

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