float:右转到下一行 [英] float:right goes to next line

查看:105
本文介绍了float:右转到下一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试将文字放在页面的左侧和右侧并使用:

< div>

< span> blah blah< / span>

< span style =" float:right"> blah blah< / span>

< / div>

第二个文本确实在右边但下一行。我在做什么

错了?


TIA。

Hi,
I am trying to put text on left and right side of the page and used:
<div>
<span>blah blah</span>
<span style="float:right">blah blah</span>
</div>
The 2nd text does go to the right but the next line. What am I doing
wrong?

TIA.

推荐答案

as*******@hotmail.com 写道:

您好,

我正在尝试将文字放在页面的左侧和右侧并使用:

< div>

< span> blah blah< / span>

< span style =" float:right"> blah blah< / span>

< / div>

第二个文本确实在右边但是下一行。我在做什么

错了?
Hi,
I am trying to put text on left and right side of the page and used:
<div>
<span>blah blah</span>
<span style="float:right">blah blah</span>
</div>
The 2nd text does go to the right but the next line. What am I doing
wrong?



没什么。据我所知_should_工作,但不是。

浏览器错误。如果您将其更改为此,则呈现OK:

< div>

< span style =" float:right"> blah blah< / span>

< span> blah blah< / span>

< / div>

-

Rik Wasmus

Nothing really. As far as I know it _should_ work, but doesn''t.
Browser bug. If you change it to this it renders OK:
<div>
<span style="float:right">blah blah</span>
<span>blah blah</span>
</div>
--
Rik Wasmus


2007-01-12,Rik< lu ************ @ hotmail.comwrote:
On 2007-01-12, Rik <lu************@hotmail.comwrote:
as*******@hotmail.com 写道:

>
我正在尝试将文字放在页面的左侧和右侧并使用:
< div>
< span> ; blah blah< / span>
< span style =" float:right"> blah blah< / span>
< / div>
第二个文字确实转到了对,但下一行。我在做什么
错了?
>Hi,
I am trying to put text on left and right side of the page and used:
<div>
<span>blah blah</span>
<span style="float:right">blah blah</span>
</div>
The 2nd text does go to the right but the next line. What am I doing
wrong?



没什么。据我所知_should_工作,但不是。

浏览器错误。如果您将其更改为此,则呈现OK:
< div>
< span style =" float:right"> blah blah< / span>
< span> blah blah< / span>
< / div>


Nothing really. As far as I know it _should_ work, but doesn''t.
Browser bug. If you change it to this it renders OK:
<div>
<span style="float:right">blah blah</span>
<span>blah blah</span>
</div>



是的,这是Firefox中的已知错误。除非浮动首先出现,否则它会向下移动一行,这与规格相反。


但实际上在很多方面都比较简单。


如果有几个单词后跟浮动,浏览器

不知道浮点数应该从哪个行开始直到它有一个去在

布置单词(这些单词可能占用两行半左右)。

然后它进入浮点数并将其放入。但现在漂浮物在

的方式,那条线上的字可能不再适合 - 线路

可能需要被打破。这可能导致

浮动之前的单词在其下方的内容中浮动,这被规则排除,

因此浏览器可能必须重新启动该行,这次将浮动

放在下一行。


如果它将浮动放在下一行(除非它正好在

start),它的工作要容易得多。

Yes, this is a known bug in Firefox. Unless the float comes first thing,
it goes one line down, which is contrary to the spec.

But actually simpler in many ways.

In the case where there are a few words followed by a float, the browser
doesn''t know which line the float should start on until it has a go at
laying out the words (the words might take up two and half lines or so).
Then it gets to the float, and puts that in. But now that the float''s in
the way, the words on that line might not all fit any more-- the line
might need to be broken. This could result in the word preceding the
float in the content ending up below it, which is excluded by the rules,
so the browser may have to restart the line, this time putting the float
on the next line.

If it puts the float on the next line anyway (unless it''s right at the
start), its job is a lot easier.




Rik写道:

Rik wrote:
as*******@hotmail.com 写道:



我正在尝试将文字放在页面的左侧和右侧并使用:

< div>

< span> blah blah< / span>

< span style =" float:right"> blah blah< / span>

< / div>

第二个文本确实在右边但是下一行。我在做什么

错了?
Hi,
I am trying to put text on left and right side of the page and used:
<div>
<span>blah blah</span>
<span style="float:right">blah blah</span>
</div>
The 2nd text does go to the right but the next line. What am I doing
wrong?



没什么。据我所知_should_工作,但不是。

浏览器错误。如果您将其更改为此,则呈现OK:

< div>

< span style =" float:right"> blah blah< / span>

< span> blah blah< / span>

< / div>

-

Rik Wasmus


Nothing really. As far as I know it _should_ work, but doesn''t.
Browser bug. If you change it to this it renders OK:
<div>
<span style="float:right">blah blah</span>
<span>blah blah</span>
</div>
--
Rik Wasmus



谢谢里克。把浮动:右边首先解决问题。

顺便说一下,我在IE7和FF中都有这个问题。

Thanks Rick. Putting the float:right first fixed the problem.
By the way, I had this problem in IE7 as well as FF.


这篇关于float:右转到下一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆