Html 使图像和段落并排放置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3113481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:36:15  来源:igfitidea点击:

make an image and a paragraph sit next to each other

htmlalignmentimageparagraph

提问by JamesTBennett

I have a box with an image and some txt and I want the txt to be horizontal to the image. I know this may be a pretty easy question but I can't seem to find a good answer on the interwebs. thanks for any help.

我有一个带有图像和一些 txt 的框,我希望 txt 与图像水平。我知道这可能是一个非常简单的问题,但我似乎无法在互联网上找到好的答案。谢谢你的帮助。

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

回答by Rowland Shaw

Take a look at CSS's float property, for example:

看看 CSS 的 float 属性,例如:

<div id='container'>
 <img src='someimage.jpg' style='float: left;'/>
 <p>some text (that will now wrap around the image</p>
</div>