【问题标题】:How do I align the text beside the picture?如何对齐图片旁边的文字?
【发布时间】:2021-05-06 05:22:15
【问题描述】:

代码是:

<main>
    <p>The following decades show the data:</p><br>
    <img src="fiba-1950.jpg"><p>-1950</p>
    <p>1960</p>
</main>

文本在图像下方,我尝试更改p 的值,但这也会更改上段。我希望文本向左对齐,以便两个图像之间有空间。 “——” 谢谢

【问题讨论】:

    标签: html css text alignment


    【解决方案1】:
    <div style="display: flex">
      <p>The following decades show the data:</p><br>
      <img src="fiba-1950.jpg"><p>-1950</p>
      <p>1960</p>
    </div>
    

    这会对你有所帮助。如果你使用bootstrap,会更容易。

    【讨论】:

      【解决方案2】:

      你可以像这样为图像添加浮动属性:

      <img src="fiba-1950.jpg" style="float: right;">
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-17
        • 2013-05-10
        • 2018-02-26
        • 2020-10-04
        • 1970-01-01
        相关资源
        最近更新 更多