图像旁边的段落

时间:2015-08-12 21:09:48

标签: html css

我正在尝试让文字在我的图片旁边正确排列。这就是我所尝试过的,但它正在抛弃文本,使得间距对眼睛非常不愉快。对此的任何帮助将不胜感激。

<p><img src="../../images/stop.jpg" style="width:40px;height:40px;">Your transaction requires special instructions from our office.  Please complete this Special Handling form, and we will contact you within three business days to provide assistance.  Please do not complete this mail packet until you receive our instructions.  Thank you!</p>

2 个答案:

答案 0 :(得分:3)

我会用一个小小的CSS将图像浮动到左侧,这样可以让文本在它旁边浮动:

img {
  float: left;
}
<p>
  <img src="../../images/stop.jpg" style="width:40px;height:40px;">Your transaction requires special instructions from our office. Please complete this Special Handling form, and we will contact you within three business days to provide assistance. Please do not complete this mail packet until you receive our instructions.
  Thank you!</p>

答案 1 :(得分:1)

请检查以下代码。

p img{float:left;margin:0 10px 10px 10px}

http://jsfiddle.net/sobxf85t/