gpt4 book ai didi

html - 页脚 div 定位到错误的位置

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

html

<div id="wrap">
<div id="header">
header
</div>
<div id="content">
content
</div>

<div id="sidebar">
in here will be login module
</div>
</div>
<div id="footer">
asdfasdf
</div>

CSS

#wrap{
width:100%;
margin:0 auto;
}
#header{
width:100%;
height:50px;
background:orange;
}
#content{
width:100%;
height:500px;
background:green;
float:;
}
#sidebar{
width:25%;
height:550px;
background:red;
float:left;
position:relative;
bottom:550px;
left:20px;
}
#footer{

float:left;
position:ralative;
}

我希望页脚 div 从左侧开始(与内容和页眉 div 相同),但它以一个奇怪的点开始。

这是演示

http://jsfiddle.net/64Uq5/3/

并且,有人可以将我与理解位置和 float 的良好教程联系起来吗?

我认为这就是为什么会搞砸的原因,但对于前端设计新手来说,我不明白这意味着什么。

最佳答案

添加 left:0px; 在你的侧边栏 id #sidebar

#sidebar {
宽度:25%;
高度:550px;
背景:红色;
float :左;
position:relative;
底部:550px;
左:0;
}

关于html - 页脚 div 定位到错误的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20368736/

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