【问题标题】:Placing image after text without adding space between lines在文本之后放置图像而不在行之间添加空格
【发布时间】:2015-07-27 03:10:41
【问题描述】:

在这个小提琴https://jsfiddle.net/spdvoc06/ 中,最后一行被拉伸以放置图像。任何人都可以帮忙修复它吗?我需要在文本之后放置第二张图片,而不需要在行之间添加空格。

<img src="https://www.getdesignschool.com/wp-content/uploads/2015/07/up.jpg" alt="" width="56" height="44" />
<p style="display:inline;">I want to learn how to design but I spend so much time just reading I never remember it all. I need something that teaches me in practical way, and gives me feed-back on what I've created...
</p>
<img src="https://www.getdesignschool.com/wp-content/uploads/2015/07/bottom.jpg" alt="" width="56" height="44" />

【问题讨论】:

  • 您能否详细说明一下这个问题以及您最终想要得到什么?您的问题目前还不是很清楚。
  • 我建议您阅读有关 CSS 的更多信息。它允许您这样做。更具体地说,阅读“位置”属性。
  • @Bastiaan 我希望图像向下移动一点,并且不要在行之间添加空格
  • ^查看我的答案,得到它的工作^_^
  • 谢谢,我应该了解一下 position:absolute

标签: html css image css-position


【解决方案1】:

在最后一张图片中添加position:absolute

https://jsfiddle.net/y93su8s1/2/

【讨论】:

    【解决方案2】:

    看起来需要添加的只是最后一张图片上的“vertical-align:top”

    我为您添加并复制了代码。希望这会有所帮助!

       <img style="vertical-align:top" src="https://www.getdesignschool.com/wp-content/uploads/2015/07/bottom.jpg" alt="" width="56" height="44" />
    

    https://jsfiddle.net/spdvoc06/

    【讨论】:

      【解决方案3】:

      display:inline-blockwidth 添加到paragraph 将解决此问题。

      演示:https://jsfiddle.net/spdvoc06/1/

      【讨论】: