gpt4 book ai didi

css - Div 延伸到页面下方太远

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

好的,问题来了:

我有一个左侧菜单,它无法根据页面正确调整大小。如果内容不必滚动,则页脚应位于底部,菜单 div 应向下延伸以触及页脚。我尝试了粘性页脚技巧或 w/e 它被称为...但没有运气菜单。

这是我的 CSS:

html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: Arial, Helvetica, sans-serif;
background: #999966 url(bgbottom.png);
background-attachment: fixed;
background-position: bottom;
background-repeat: repeat-x;
}

a {
color: #29211D;
}
h2 {

font-size: 26px;
font-weight: normal;
}

.head {

background-image: url(bg.jpg);
width: 100%;
border-bottom: 4px solid #29211D;
overflow: hidden;
height: 185px;
}

.nav {

background-color: #29211D;
width: 150px;
color: white;
padding: 10px;
height: auto !important;
min-height: 100%;
font-size: 14px;
float: left;
}

.content {

font-size: 14px;
width: 80%;
float: left;
padding-left: 10px;
padding-right: 10px;
height: auto !important;
min-height: 70%;
background-color: #FFF;
border: 2px #666 solid;
margin-left: 2%;
margin-top: 1%;
}

.footer {

background-image: url(bg.jpg);
border-top: #29211D solid 3px;
border-bottom: #29211D solid 3px;
text-align: center;
font-size: 12px;
padding-top: 3px;
padding-bottom: 3px;

}

这是网站:http://www.pomaceaproject.org/dev/test.asp

最佳答案

如果我明白你想做什么,你想让导航部分触及页脚的底部吗?如果是这样,那是一个简单的更改:

将 .nav 类的最小高度属性从 min-height: 70%; 更改为 min-height: 100%;

Demo (obviously without all the pictures on it)

当前的 .css:

@charset "utf-8";
/* CSS Document */

html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: Arial, Helvetica, sans-serif;
background: #999966 url(bgbottom.png);
background-attachment: fixed;
background-position: bottom;
background-repeat: repeat-x;
}

a {
color: #29211D;
}
h2 {

font-size: 26px;
font-weight: normal;
}

.head {

background-image: url(bg.jpg);
width: 100%;
border-bottom: 4px solid #29211D;
overflow: hidden;
height: 185px;
}

.nav {

background-color: #29211D;
width: 150px;
color: white;
padding: 10px;
height: auto !important;
min-height: 73%;
font-size: 14px;
float: left;
overflow: auto;

}

.content {

font-size: 14px;
width: 80%;
float: left;
height: auto !important;
padding-left: 10px;
padding-right: 10px;
background-color: #FFF;
border: 2px #666 solid;
margin-left: 2%;
margin-top: 1%;
}

.footer {

background-color: #999966; /* Can probably be removed as you will have a background image */
width: 100%;
position: absolute;
bottom: 0;
background-image: url(bg.jpg);
border-top: #29211D solid 3px;
border-bottom: #29211D solid 3px;
text-align: center;
font-size: 12px;
padding-top: 3px;
padding-bottom: 3px;
z-index: 100; /* Since it is will need to overlay the background of the navigation behind it */
}

希望对您有所帮助:)

关于css - Div 延伸到页面下方太远,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4663060/

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