我有一个带有图像和一些 txt 的框,我希望 txt 与图像水平。我知道这可能是一个非常简单的问题,但我似乎无法在互联网上找到一个好的答案。谢谢你的帮助。
<div id='container'>
<img src='someimage.jpg'/>
<p>some text</p>
</div>
看一下 CSS 的 float 属性,例如:
<div id='container'>
<img src='someimage.jpg' style='float: left;'/>
<p>some text (that will now wrap around the image</p>
</div>
我建议您将文本和图像放在一个表格中,在同一行中,图像位于第一列,而文本位于第一行的第二列。这是代码
<div id='container'>
<table>
<tr>
<td><img src='someimage.jpg'/></td>
<td><p>some text</p></td>
</tr>
</table>
</div>