文本环绕图像(或任何元素)
有没有办法使用 CSS 将文本包裹在元素(例如图像)的两侧。 我试图将图像放置在段落中间,并希望文本流过它。 请参阅图片示例。
定位元素通常会将其带出文档流; 所以那是行不通的。
Is there a way with CSS to wrap text on both sides of an element (an image for example). I am trying to have an image positioned in the middle of a paragraph and would like text to flow over it. Please see the image for an example.
Positioning an element typically takes it out of the document flow; so that doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不这么认为,不。 必须使用多个文本列。
我只是整理了一种可能的解决方案。 您可以通过 http://www.sampsonresume.com/labs/img- 访问它中间/
I don't think so, no. Not without working with multiple text-columns.
I just threw together one possible solution. You can access it at http://www.sampsonresume.com/labs/img-in-middle/
我见过的唯一与此类似的东西是 A List Apart 文章: Cross-Column Pull-Out第二部分:自定义剪影。 您仍然需要多个文本列,甚至 ALA 将其列为“实验性”。 不过,这可能值得一看。
示例。
The only thing that I have seen similar to this would be the A List Apart article: Cross-Column Pull-Out Part Two: Custom Silhouettes. You still need multiple text columns, and even ALA lists it as "experimental". It may be worth checking out, though.
Example here.
并非没有一些非常棘手/乏味的文本解析。 但是,如果您让尝试阅读该文本的人每行在图像上来回跳转两次,他们会讨厌您,所以这可能是一件好事。
Not without some very tricky/tedious text parsing. But anyone trying to read that text would hate you if you made them jump back and forth across an image twice per line, so that's probably a good thing.