html - 图像和跨度在同一行?
问题描述
我做了 2 个跨度,一个带有文本,一个带有图像,但它们不在同一行。有人有帮助吗?
HTML
.übersicht{
font-size: x-large;
text-align: left;
}
.bild{
text-align: right;
}
<span class="überschrift">
<h1>Übersicht</h1>
<ul>
<li>(Sir) Timothy John Berners-Lee</li>
<li>Geboren am 8. Juni 1955 in London</li>
<li>Britischer Physiker & Informatiker</li>
<li>Begründer des World Wide Web</li>
<li>Erfinder von HTML</li>
</ul>
</span>
<span class="bild">
<img src="bernerslee.png" alt="Dieses Bild ist nicht verfügbar." />
</span>
解决方案
您可以将跨度包装在 div 中并在 css 下添加:
.übersicht {
font-size: x-large;
text-align: left;
}
.bild {
text-align: right;
}
.display-flex {
display: flex;
}
<div class="display-flex">
<span class="überschrift">
<h1>Übersicht</h1>
<ul>
<li>(Sir) Timothy John Berners-Lee</li>
<li>Geboren am 8. Juni 1955 in London</li>
<li>Britischer Physiker & Informatiker</li>
<li>Begründer des World Wide Web</li>
<li>Erfinder von HTML</li>
</ul>
</span>
<span class="bild">
<img src="bernerslee.png" alt="Dieses Bild ist nicht verfügbar." />
</span>
</div>
推荐阅读
- docker - 如何连接到docker主机?
- google-apis-explorer - 一种从谷歌云视觉 OCR 获取所有文本的单个连续文本块的方法?
- java - 提供声明 - 使复合赋值非法,而简单赋值合法
- javascript - 动画元素(进度条)向下滚动效果对容器 div 中的 prepend(新进度条)
- azure - Azure Devops 中缺少克隆按钮
- c# - 查询 SQLite 数据库时,当月份从“单”位变为“双位”时,无法选择日期范围
- ruby-on-rails - 当我从 HAML 文件生成视图时,ID 来自哪里?
- python - 我应该如何退出这个 python 程序?
- reactjs - 当用户滚动过去某个标记时如何执行功能的反应
- c - Char 用 Scanf 存储整个字符串?