【发布时间】:2020-12-27 18:29:54
【问题描述】:
我正在尝试让我的带有 fontawesome 图标的列表项看起来像这样:
但目前,它们看起来像这样:
这是我的 HTML:
<section id="black-studio-tinymce-6" class="widget widget_black_studio_tinymce">
<h2 class="widget-title">Contact Us</h2>
<div class="textwidget">
<ul>
<li>021 552 1187</li>
<li>info@powersol.co.za</li>
<li>Unit S19 Spearhead Business Park<br>
cnr Montague Drive & Freedom Way<br>
Montagu Gardens<br>
Cape Town, South Africa</li>
</ul>
</div>
</section>
这是我的样式:
section#black-studio-tinymce-6 div.textwidget ul {
list-style: none;
padding-left: 0;
margin: 0;
li {
&:first-child:before {
@extend .font-awesome-footer;
content: '\f095';
}
&:nth-child(2):before {
@extend .font-awesome-footer;
content: '\f003';
}
&:last-child:before {
@extend .font-awesome-footer;
content: '\f041';
}
}
}
如何缩进如图所示的fontawesome链接后的内容? 希望你能帮忙。
【问题讨论】:
-
将您的
li:before分组并扩展.font-awesome-footer以节省空间,我认为您应该考虑仅使用nth-child以获得更一致的代码