gpt4 book ai didi

css - 将图标与 css 中的右中心对齐

转载 作者:太空宇宙 更新时间:2023-11-04 07:35:56 25 4
gpt4 key购买 nike

js fiddle1.尝试通过 CSS 将图标对齐到右中间侧2. 我试图在用户选择正确答案时显示图标。

<style>

. li.rightAnswerOption:after {
content: "\2714";
font-family: FontAwesome;
display: block;
font-size: 24px;
font-weight: 999;
float: right;
margin-right: -15px;
width: 1.3em;
color: #0d923f;
}

li.wrongAnswerOption:after {
content: "\2715";
font-family: FontAwesome;
display: block;
margin-right: -15px;
padding-bottom: 5px;
font-size: 24px;
font-weight: bolder;
float: right;
width: 1.3em;
color: red;
}

            <ul class="list-group col-md-offset-2 col-md-8 col-sm-offset-1 col-sm-9 col-xs-offset-0 col-xs-12">

<li class="question-option list-group-item answerOption wrongAnswerOption">1. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

        </ul>

最佳答案

绝对位置就是你的答案

ul li{
background: #DDD;
padding: 5px 1.3em 5px 5px;
position: relative;
}
li.right:after,
li.wrong:after{
display: block;
font-family: FontAwesome;
font-size: 24px;
font-weight: 999;
position: absolute;
right: 0;
top: calc(50% - 12px);
width: 1.3em;
}
li.right:after{
color: #0d923f;
content: "\2714";

}
li.wrong:after{
color: red;
content: "\2715";
}
<ul>
<li class="right">Lorem Ipsum</li>
<li class="wrong">Dolor Sit amet</li>
</ul>

关于css - 将图标与 css 中的右中心对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48958193/

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