IE7:浮动里面

;放下一行(包括 jsfiddle)

发布于 2024-12-05 09:46:49 字数 640 浏览 2 评论 0原文

我有一个文本块,其末尾有一个向右浮动的跨度。像这样:

<p>Some text describing an event that may wrap to several lines. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur.<span>January 1, 2012</span>

使用这样的CSS:

span { float:right; }

这里是jsfiddle: http://jsfiddle.net/eusonic/ aL6J5/8/

在所有现代浏览器上,跨度显示在与段落最后一行相同的行上,这就是我想要的(如果段落最后一行是,它将被强制向下一行)也很长,这是完美的)。在 IE7 中,无论如何,跨度都会显示在段落下方。我尝试将 display:block 添加到跨度并将 float:left 添加到段落。运气不好。

I have a block of text whith with a span at the end that is floated right. Like this:

<p>Some text describing an event that may wrap to several lines. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur.<span>January 1, 2012</span>

With css like this:

span { float:right; }

Here it is on jsfiddle: http://jsfiddle.net/eusonic/aL6J5/8/

On all modern browsers the span displays on the same line as the last line of the paragraph, which is what I want (It will be forced down to the next line if the last line of the paragraph is too long, which is perfect). In IE7 the span displays below the paragraph no matter what. I have tried adding display:block to the span and float:left to the paragraph. No luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟凡古楼 2024-12-12 09:46:49

您将无法在 IE 7 中使用纯 css 来执行此操作。

将两个元素放置在一个容器中,然后将

元素向左浮动,将 向右浮动的选项是可行的,但请记住,它会获胜达不到您想要的相同外观。

这背后的想法是在高度未知的段落之后添加日期吗?你想达到什么目的?

我可以建议做一些这样的事情吗?

You won't be able to do this in IE 7- with pure css.

The option of placing both elements in a conatiner, then floating the <p> element left and the <span> right is viable, but keep in mind that it won't achieve the same look that you want.

Is the idea behind this to have the date after a paragraph(s) with unknown height(s)? What are you trying to achieve?

Might I suggest doing something like this?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文