gpt4 book ai didi

使用固定宽度的容器时,HTML/CSS(Twitter Bootstrap)页脚无法正确显示?

转载 作者:行者123 更新时间:2023-11-28 12:57:48 24 4
gpt4 key购买 nike

在我的 HTML 页面中,我制作了一个包含整个正文(包括页眉和页脚)的容器。但我面临的问题是,当我将容器设置为固定宽度时,页眉和页脚的左侧显示正常,但页脚的右侧无限期地延伸。这是我的 CSS:

.container
{
width: 1024px;
}

.footer
{
float: left;
margin: 0px;
width:100%;
background: #0B3B17;
height: 100px;
position: absolute;
bottom: 0;
}

我认为这可能与绝对定位有关,但我需要我的页脚绝对定位,因为它一直在移动。你有什么建议?顺便说一句,我正在使用 Twitter Bootstrap 进行开发。感谢您的帮助。

最佳答案

添加position:relative;.container规则。

.container {
width: 1024px;
position: relative;
}

关于使用固定宽度的容器时,HTML/CSS(Twitter Bootstrap)页脚无法正确显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16409318/

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