html - 图片旁边的段落

标签 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>

最佳答案

我会用一点 CSS 将图像 float 到左侧,这样文本就可以 float 在它旁边:

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>

关于html - 图片旁边的段落,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31975466/

相关文章:

html - 没有 "display: table-row"的 CSS 多行表

javascript - 具有相同 id 的 jQuery 多个按钮

html - TD 高度适用于元素,但不适用于 CSS

css - Materialize CSS 模态在另一个模态中被裁剪

javascript - 减少选择元素中的下拉宽度

html - 可以将 INPUT 元素附加到多个表单吗?

css - HTML5 中的页眉、页脚和 index.html 问题

php - Float left 在 Drupal 表单中无法正常工作

jQuery UI Position right top set's CSS to left top

html - 如何在 div 背景上应用最小宽度?