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

问题描述 投票:4回答:3

我很惊讶我无法找到解决方案。我想在我的文档顶部附近放置一个小桌子(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...

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

html css tabular
3个回答
6
投票

只是float右边的表(这也是你应该如何定位图像):

<table style="float: right">
    <!-- ... -->
</table>
<p>Bunch of text...</p>

但是:ぁzxswい



3
投票

将表格浮动并通过CSS给它一个边距:

table {
    float: right; /* floats the table to the right,
                     allowing text to wrap around it */
    margin: 12px; /* adds buffer space around the table */
}

table { float:right; width:300px; margin:0 0 10px 10px; }​

© www.soinside.com 2019 - 2024. All rights reserved.