【发布时间】:2021-04-07 14:25:40
【问题描述】:
我有以下sn-p的代码:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
</head>
<ul>
<li>
<span class="fa-stack" style="width: auto;">
<!-- The icon that will wrap the number -->
<span class="fa fa-square-o fa-stack-2x"></span>
<!-- a strong element with the custom content, in this case a number -->
<strong class="fa-stack-1x">1</strong>
</span>
This is a sentence.
</li>
</ul>
</body>
</html>
这是来自一个更大的项目(简化了代码),我需要在父跨度类上有style="width:auto"。
在不删除style="width:auto" 的情况下,我试图实现三件事:
- 将框中的“1”居中
- 将 1 与“这是一个句子”放在同一行
- 使“这是一个句子”出现在方框旁边,而不是在方框内重叠。
这看起来类似于图像here,除了 1 与“这是一个句子”不在同一行 - 有人知道如何实现吗?
【问题讨论】:
标签: html css icons font-awesome