5

これに対する解決策を見つけることができなかったことに驚いています。次のコードで画像を処理するのと同じように、小さなテーブル (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でこれに対する比較的簡単な解決策はありますか?

4

3 に答える 3

7

テーブルを右にフロートするだけです (画像も同様に配置する必要があります)。

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

デモ: http://jsfiddle.net/ambiguous/ZLfg7/1/

于 2012-05-20T02:39:03.660 に答える
5

jsFiddle

table {
    float: right; /* floats the table to the right,
                     allowing text to wrap around it */
    margin: 12px; /* adds buffer space around the table */
}
于 2012-05-20T02:42:33.013 に答える
4

テーブルを右にフロートさせ、CSSを介してマージンを与えます。

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

jsFiddleの例

于 2012-05-20T02:40:38.373 に答える