我如何让我的DIV出现在另一个DIV下面 [英] How can I get my DIV to appear below another DIV
问题描述
我有这种情况:
< div A>
< div B>
< div C>
Div A是B和C的全屏宽度容器。
Div B是小矩形表示100乘200像素
Div C是另一个小矩形,例如100乘200像素。
现在发生的是B和C出现在相同线。我想让C低于B.是否有可能以这种方式定位Div's。我希望我有道理。
我猜测他们已经飘到了左边,或者他们不会在旁边。在C上简单的 clear:left
就可以做到这一点:
# B {
float:left;
width:100px;
height:200px;
背景:#0f0;
margin:5px;
}
#C {
float:left;
clear:left;
width:100px;
height:200px;
背景:#00f;
margin:5px;
}
为了清晰起见,我添加了一些边距,填充和背景。 p>
示例: http://jsfiddle.net/ambiguous/uCBYV /
I have this situation:
<div A>
<div B>
<div C>
Div A is a full screen width container for B and C. Div B is a small rectangle say 100 by 200 px Div C is another small rectangle say 100 by 200 px.
Now what happens is that B and C appear on the same line. What I would like is for C to be below B. Is it possible to position Div's in this way. I hope I make sense.
I'm guessing that they're floated to the left already or they wouldn't be beside each other. A simple clear: left
on C will do the trick:
#B {
float: left;
width: 100px;
height: 200px;
background: #0f0;
margin: 5px;
}
#C {
float: left;
clear: left;
width: 100px;
height: 200px;
background: #00f;
margin: 5px;
}
I've added some margins, paddings, and backgrounds for clarity.
Example: http://jsfiddle.net/ambiguous/uCBYV/
这篇关于我如何让我的DIV出现在另一个DIV下面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!