漂浮的div [英] floating divs
问题描述
我希望漂浮的div能够浮动,然后标题会在它们之后出现在左边的
之后。这就是我认为清除花车的原因是
for,但在这个例子中,标题位于浮动
div的右侧,没有任何清除。我做错了什么?
这是网址: http://www.reenie.org/test/test5.php
以下是代码:
< html>
< head>
< title>
asdf
< / title>
< ;风格>
.onetime {float:left; margin-right:1em; width:20em; border:solid 1px;}
.clear {clear:both; line-height:0px}< / style>
< / head>
< body>
< div class =" ;一次性>
xxxxxxxxxx
< / div>
< div class =" onetime">
xxxxxxxxxxx
< / div>
< div class =" onetime">
xxxxxxxxxxxxx
< / div>
< div class =" clear">
< / div>
< ; h4>标题< / h4>
< / body>
< / html>
I would like the floating divs to float and then the header to come
after them , on the left. That''s what I thought clearing the floats was
for, but in this example, the header is to the right of the floating
divs, nothing is cleared. What am I doing wrong ?
Here is the url:http://www.reenie.org/test/test5.php
Here is the code:
<html>
<head>
<title>
asdf
</title>
<style>
.onetime{float:left; margin-right:1em;width:20em;border:solid 1px;}
.clear { clear: both; line-height: 0px } </style>
</head>
<body>
<div class="onetime">
xxxxxxxxxx
</div>
<div class="onetime">
xxxxxxxxxxx
</div>
<div class="onetime">
xxxxxxxxxxxxx
</div>
<div class="clear">
</div>
<h4>a heading</h4>
</body>
</html>
推荐答案
meltedown< gr ***** @ reenie.org>写道:
meltedown <gr*****@reenie.org> wrote:
我想浮动的divs浮动,然后标题来到它们之后,在左边。这就是我认为清除浮动的原因是
,但在这个例子中,标题位于浮动
div的右侧,没有任何清除。我做错了什么?
这是网址: http://www.reenie.org/test/test5.php
I would like the floating divs to float and then the header to come
after them , on the left. That''s what I thought clearing the floats was
for, but in this example, the header is to the right of the floating
divs, nothing is cleared. What am I doing wrong ?
Here is the url:http://www.reenie.org/test/test5.php
标题右侧显示* * *那你是什么?b $ b大约是什么?
-
Spartanicus
The header is *not* displayed to the right of the divs, so what are you
on about?
--
Spartanicus
Spartanicus写道:
Spartanicus wrote:
meltedown< gr ***** @ reenie.org>写道:
meltedown <gr*****@reenie.org> wrote:
我想浮动的divs浮动,然后标题来到它们之后,在左边。这就是我认为清除浮动的原因是
,但在这个例子中,标题位于浮动
div的右侧,没有任何清除。我做错了什么?
这是网址: http://www.reenie.org/test/test5.php
I would like the floating divs to float and then the header to come
after them , on the left. That''s what I thought clearing the floats was
for, but in this example, the header is to the right of the floating
divs, nothing is cleared. What am I doing wrong ?
Here is the url:http://www.reenie.org/test/test5.php
标题右侧显示标题* *,那你是什么?
关于?
The header is *not* displayed to the right of the divs, so what are you
on about?
它在IE中,但不在Firefox中。
Its is in IE, but not in firefox.
meltedown< ; GR ***** @ reenie.org>写道:
meltedown <gr*****@reenie.org> wrote:
我想浮动的divs浮动然后标题来了
, 在左边。这就是我认为清除浮动的原因是
,但在这个例子中,标题位于浮动
div的右侧,没有任何清除。我做错了什么?
这是网址: http://www.reenie.org/test/test5.php
I would like the floating divs to float and then the header to come
after them , on the left. That''s what I thought clearing the floats was
for, but in this example, the header is to the right of the floating
divs, nothing is cleared. What am I doing wrong ?
Here is the url:http://www.reenie.org/test/test5.php
标题右侧显示标题* *,那你是什么?
关于?
The header is *not* displayed to the right of the divs, so what are you
on about?
它在IE中
Its is in IE
不在我的IE6 / win中(如果我注释掉了)其中一个浮动的div,否则我没有足够的屏幕宽度。
http://homepage.ntlworld.ie/spartanicus/test5.htm
顺便说一下,如果现有元素可用,使用它来附加清晰的
属性(在示例中,您可以使用h4,不需要div)。
-
Spartanicus
Not in my IE6/win (if I comment out one of the floated divs, otherwise I
don''t have sufficient screen width available).
http://homepage.ntlworld.ie/spartanicus/test5.htm
Btw, if an existing element is available, use that to attach the clear
property to (in the example you can use the h4, no need for the div).
--
Spartanicus
这篇关于漂浮的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!