【发布时间】:2021-12-25 16:35:16
【问题描述】:
这个 CSS 用于替换列表项项目符号的社交媒体图标,但现在它给了我一个显示项目符号、图标和文本的列表。
为什么有“list-style: none;”停止工作?
.social-follow {
margin: 0.2em 0 2em 3em;
}
.social-follow ul.follow-background {
list-style: none outside !important;
margin: 0 0 0 0.6em;
padding: 0 0 0 0.6em;
overflow: hidden;
}
.social-follow ul.follow-background + li.follow {
line-height: 32;
background: no-repeat left 1px;
/** fixed vertical position **/
margin: 0.3em 0 0 -0.6em;
padding: 0 0 0 2.7em;
overflow: hidden;
}
li.follow.chapicon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/chapter_logo_54pxtype-32x32-28x28.png') no-repeat left 1px;
}
li.follow.facebookicon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/facebook-icon-28x28.png') no-repeat left 1px;
}
li.follow.flickricon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/fluid-flickr-logo-28x28.png') no-repeat left 1px;
}
li.follow.instaicon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/instagram-logo-28x28.png') no-repeat left 1px;
}
li.follow.linkedinicon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/linkedin-logo-28x28.png') no-repeat left 1px;
}
li.follow.pinteresticon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/pinterest-logo-28x28.png') no-repeat left 1px;
}
li.follow.rssblueicon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/rss-logo-blue-28x28.png') no-repeat left 1px;
}
li.follow.skylineicon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/logo-skyline_only-28x28.png') no-repeat left 1px;
}
li.follow.twittericon {
background: url('https://wdcb.stcwdc.org/wp-content/uploads/twitter-logo-28x28.png') no-repeat left 1px;
}
<div class="social-follow">
<ul class="follow-background">
<li class="follow facebookicon"><a href="https://www.facebook.com/STCWDCMB/" rel="nofollow noopener noreferrer">Facebook page</a></li>
<li class="follow flickricon"><a href="https://www.flickr.com/photos/stcwdc/sets" rel="nofollow noopener noreferrer">Flickr Photo Albums</a></li>
<li class="follow instaicon"><a href="https://www.instagram.com/stc_wdcb/" rel="nofollow noopener noreferrer">Instagram</a></li>
<li class="follow linkedinicon"><a href="https://www.linkedin.com/groups?gid=156478" rel="nofollow noopener noreferrer">LinkedIn Group</a></li>
<li class="follow pinteresticon"><a href="https://www.pinterest.com/stcwdcmb/" rel="nofollow noopener noreferrer">Pinterest page</a></li>
<li class="follow twittericon"><a href="https://twitter.com/stcwdc" rel="nofollow noopener noreferrer">Twitter @stcwdc</a></li>
</ul>
</div>
【问题讨论】:
-
拼写错误!重要;
-
.social-follow ul.follow-background+li.follow必须是.social-follow ul.follow-background li.follow -
@Madhuri 是的,谢谢。在发布这个问题之前,我以为我已经解决了这个问题。
-
@connexo 谁说
line-height: 32'将不起作用。请如果您不了解 CSS,请不要说您不知道的内容。 CSS 在没有单位的情况下大部分时间都可以正常工作,事实上, line-height 就是这样使用的! -
你可以说这样使用它违反了规范。但是像这样使用它是有效的。
padding: 0也有效!
标签: css background-image bulletedlist