【问题标题】:heading text wont appear next to image source标题文本不会出现在图像源旁边
【发布时间】:2020-10-22 11:19:00
【问题描述】:

所以我目前正在制作一个博客,我想在网页的左上角放一张图片,在它旁边我想在它旁边放一个 h1 标签。我尝试使用跨度标签,但它们不起作用,我的代码不起作用的任何原因?我是否需要学习 css 才能将文本正确放置在图片旁边?

 <span>
  <img src="Blocks.jpg" width="100" height="100" alt="This image cannot load"><h1>TheCyberJournalist</h1>
  </span>

【问题讨论】:

    标签: html web-development-server


    【解决方案1】:

    当然,要做到这一点,你必须使用一个非常简单的 css。

    这样的事情正在起作用:

    <span style="display: flex;">
      <img src="Blocks.jpg" width="100" height="100" alt="This image cannot load"><h1>TheCyberJournalist</h1>
    </span>

    【讨论】:

      【解决方案2】:

      h1 元素具有display: block 属性 - 您需要将显示属性更改为inline

      <span>
        <img src="https://media.newswest9.com/assets/CCT/images/20f11c7a-0e95-4440-af3a-1926cfb5e15a/20f11c7a-0e95-4440-af3a-1926cfb5e15a_360x203.jpg" width="150" height="100" alt="This image cannot load"><h1 style="display: inline">TheCyberJournalist</h1>
        </span>

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-27
        • 2013-05-10
        • 2021-05-06
        • 1970-01-01
        • 2021-07-24
        • 1970-01-01
        相关资源
        最近更新 更多