gpt4 book ai didi

javascript - 如何使图标与文本左侧分开?

转载 作者:太空宇宙 更新时间:2023-11-04 01:19:00 24 4
gpt4 key购买 nike

这是我的代码:

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

<span>
<i class="fa fa-check"></i>
this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text .
</span>

看到了吗?复选图标是文本的一部分,我不想要它。我想将所有文本垂直对齐(在左侧)。我该怎么做?

最佳答案

你可以只添加一个display: flex;

span {
display: flex;
}

i.fa-check {
margin-right: .5rem;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />

<span>
<i class="fa fa-check"></i>
this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text this is a test text .
</span>

关于javascript - 如何使图标与文本左侧分开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49521294/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com