如何将列表图标及其内容集中?
希望您能帮助我...我尝试复制一个网站,但我不知道如何对图标列表和内容进行中心对齐。
#container-txt > ul > li {
color: var(--terciary-color);
font-weight: 700;
list-style-position: inside;
list-style-image: url(./assets/Checkmark.svg);
margin-bottom: 0.3rem;
}
<main class="intro">
<div id="container-txt">
<h1>Share your unfiltered<br>thoughts. Get paid.</h1>
<p class="paragraph">Spense is an open platform for individuals to share their unfiltered thougths.<br>Discuss the topics you love, and get paid for doing <em>just</em> that.</p>
<ul>
<li>Receive 99% off the earnings.</li>
<li>Get paid via Debit Card, ACH or PayPal.</li>
<li>Withdraw your earnings anytime.</li>
</ul>
</div>
</main>
I hope you can help me... I trying to copy a site but I don't know how to do a center alignment of an icon list and a content.
#container-txt > ul > li {
color: var(--terciary-color);
font-weight: 700;
list-style-position: inside;
list-style-image: url(./assets/Checkmark.svg);
margin-bottom: 0.3rem;
}
<main class="intro">
<div id="container-txt">
<h1>Share your unfiltered<br>thoughts. Get paid.</h1>
<p class="paragraph">Spense is an open platform for individuals to share their unfiltered thougths.<br>Discuss the topics you love, and get paid for doing <em>just</em> that.</p>
<ul>
<li>Receive 99% off the earnings.</li>
<li>Get paid via Debit Card, ACH or PayPal.</li>
<li>Withdraw your earnings anytime.</li>
</ul>
</div>
</main>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用
背景图像
只需用指向图像的链接替换base64即可。如果要更改图标的大小,然后编辑自定义属性
- IconSize:1.5em
上:root (&lt; html&gt;
)元素。请注意,这与line-height
&lt; li&gt;
相关超过1行You can try with
background-image
just replace the base64 with a link to your image. This will vertically align the icon to the center of the first line (even it wraps onto more lines)If you want to change the size of the icon then edit the custom property
--iconSize: 1.5em
that is set on the:root
(<html>
) element. Note that this is tied withline-height
of the<li>
so don't make it too big or small or your text will have odd spacing if it wraps onto more than 1 line-
#容器&gt; ul&gt; li
set <代码>显示:flex 和align-items:中心
。-
#container>ul>li
setdisplay:flex
andalign-items:center
.