【发布时间】:2016-05-23 07:04:11
【问题描述】:
嗨,我需要在页脚中并排放置 5 个 DIV,这 4 个 DIV 已经并排,但第 5 个 DIV 刚刚下降。
我试过浮动:左,显示:内联块,甚至增加了父DIV(页脚)的宽度,但第5个留在下面
代码如下:
CSS
#footer {
width:1240px;
padding:0px;
margin:0px auto;
background-image:url(../images/botm.jpg);
background-repeat:repeat;
background-position:center top;
}
.Aboutus {
float:left;
width:180px;
background-image:url(../images/footer.jpg);
background-position:right;
background-repeat:no-repeat;
text-align: left;
margin-left: 15px;
padding-top: 30px;
padding-right: 10px;
padding-left: 10px;
}
.ourblog {
float:left;
width:245px;
min-height:246px;
background-image:url(../images/footer.jpg);
background-position:right;
background-repeat:no-repeat;
padding-top: 30px;
padding-right: 10px;
padding-left: 10px;
}
.joinnews {
float:left;
width:190px;
min-height:246px;
background-image:url(../images/footer.jpg);
background-position:right;
background-repeat:no-repeat;
padding-top: 30px;
padding-right: 20px;
padding-left: 20px;
}
.contactus {
float:left;
width:200px;
min-height:246px;
color:#fff;
padding-top: 30px;
padding-left: 20px;
}
.Histats {
float : left;
width:50px;
min-height:1px;
color:#fff;
padding-top: 30px;
padding-left: 20px;
}
HTML
<div id="footer">
<div class="aboutus">
..code </div>
<div class="ourblog">
..code </div>
<div class="joinnews">
..code </div>
<div class="contactus">
..code </div>
<div class="Histats">
..code </div>
</div>
【问题讨论】:
-
您是否可以创建一个小提琴或共享一个错误的工作链接?
-
等待它仍在本地主机中,但我可以编辑在线的
-
您在标记中将
Aboutus类大写,而在您的css 中全部小写。最佳做法是采用约定并坚持下去。我个人从不在变量或属性中使用大写字母。 -
更正了 aboutus 类,但当我创建它时仍然没有不同的奇怪想法 jsfiddle 它可以工作 jsfiddle.net/tvsoso1e 但不在我的网站上抱歉,我无法编辑在线网络,直到我让它在本地主机上工作