如何将P元素内的文本放在图像旁边? [英] How do I put text that is inside a P element next to a image?
本文介绍了如何将P元素内的文本放在图像旁边?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
<img id="mepic" src="images/example.jpg" width="70px" height"60px">
<p>This is some example text that i want next to the image on the right hand side</p>
此刻,文本位于图像下方.如何将文字放在图片旁边?
At the moment, the text is underneath the image. How do I put the text next to the image?
推荐答案
否CSS&JavaScript,纯HTML
<p><img src="image.png" alt="image"/> Text beside image</p>
将< img>
放在< p>
内可以使图像被文本包围.阅读更多此处.
Place <img>
inside a <p>
can put the image surround by text. Read more here.
注意:< img>
标记默认为 display:inline
,而& nbsp;
是基本的不间断空格,阅读更多此处.
NOTE: <img>
tag has display: inline
by default and
is basic a non-breaking space, read more here.
<p>This is some text.
<img src="http://placehold.it/60x60" alt="Smiley face"> This is some text.</p><br/>
<p>
<img src="http://placehold.it/60x60" alt="Smiley face" align="middle"> This text is next to the image</p>
这篇关于如何将P元素内的文本放在图像旁边?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文