如何使文本环绕表格,就好像它是一个图像

Sor*_*ner 4 html css tabular

我很惊讶我无法找到解决方案.我想在我的文档顶部附近放置一个小桌子(1行,3个单元格),右边对齐,并用一个包围着它的段落,就像使用下面代码的图像一样...

    <img src="http://www.sorenwagner.ws/marty/img/ca-seal.jpg"
        align="right" width="300" height="100">
    This is a paragraph large enough to wrap around the image...
    This is a paragraph large enough to wrap around the image...
    This is a paragraph large enough to wrap around the image...
    This is a paragraph large enough to wrap around the image...
Run Code Online (Sandbox Code Playgroud)

能够在桌子周围定义填充也很好,因此文本不能直接到边框.在CSS中有一个相对简单的解决方案吗?

mu *_*ort 6

只需将表浮动到右侧(这也是您应该如何定位图像):

<table style="float: right">
    <!-- ... -->
</table>
<p>Bunch of text...</p>
Run Code Online (Sandbox Code Playgroud)

演示:http://jsfiddle.net/ambiguous/ZLfg7/1/


gme*_*ben 5

js小提琴

table {
    float: right; /* floats the table to the right,
                     allowing text to wrap around it */
    margin: 12px; /* adds buffer space around the table */
}
Run Code Online (Sandbox Code Playgroud)