IE7:浮动里面;放下一行(包括 jsfiddle)
我有一个文本块,其末尾有一个向右浮动的跨度。像这样:
<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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将无法在 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?