9

画像といくつかのtxtが入ったボックスがあり、txtを画像に対して水平にしたいと思います。これは非常に簡単な質問かもしれませんが、インターウェブで良い答えを見つけることができないようです。助けてくれてありがとう。

<div id='container'>
 <img src='someimage.jpg'/>
 <p>some text</p>
</div>
4

2 に答える 2

23

たとえば、CSSのfloatプロパティを見てください。

<div id='container'>
 <img src='someimage.jpg' style='float: left;'/>
 <p>some text (that will now wrap around the image</p>
</div>
于 2010-06-24T20:07:22.493 に答える
0

テキストと画像を同じ行のテーブルに配置することをお勧めします。画像は最初の列にあり、テキストは最初の行の2番目の列にあります。これがコードです

<div id='container'>
  <table>
    <tr>
     <td><img src='someimage.jpg'/></td>
     <td><p>some text</p></td>
    </tr>
  </table>
</div>
于 2021-12-30T12:06:11.227 に答える