html - css 背景图像 css 不适用于 ul 属性

标签 html css

我对 ul 中的背景图像属性有问题

这是 html:

<ul class="nav" style="margin-top: 15px;">
<li style="display: table-cell;"><a class="facebook1" href="https://www.facebook.com/demo" target="_block"></a></li>
    <li style="display: table-cell;"><a class="twitter" href="https://twitter.com/MobilityGo1" target="_block"></a></li>
    <li style="display: table-cell;"><a class="youtube" href="https://www.youtube.com/bcmlpn" target="_block"></a></li>
    <li style="display: table-cell;"><a class="pinterest" href="https://www.facebook.com/demo" target="_block"></a></li>
    <li style="display: table-cell;"><a class="instagram" href="https://www.facebook.com/demo" target="_block"></a></li>
</ul>

CSS:

/*social icons*/

a.facebook1 {
width: 30px;
height: 30px;
padding-left: 5px;
background: url("/files/assets/facebook1.png") no-repeat;
background-size: 30px 30px;
}
a.twitter {
width: 30px;
height: 30px;
padding-left: 5px;
background: url("/files/assets/twitter.png") no-repeat;
background-size: 30px 30px;
}
a.youtube {
width: 30px;
height: 30px;
padding-left: 5px;
background: url("/files/assets/youtube.png") no-repeat;
background-size: 30px 30px;
}
a.pinterest {
width: 30px;
padding-left: 5px;
height: 30px;
background: url("/files/assets/pinterest.png") no-repeat;
background-size: 30px 30px;
}
a.instagram {
width: 30px;
padding-left: 5px;
height: 30px;
background: url("/files/assets/instagram.png") no-repeat;
background-size: 30px 30px;
}
/*social icons*/

类 a.social 网络显示图标但不显示第一个图标

例如,当我们在网页中显示时,a.facebook1 不显示。

如果我在 a.facebook1 之前添加另一个社交图标类,则不会显示,而包括 facebook1 在内的其他图标将显示

http://prntscr.com/6chstf

更新:

我解决了将这些行移动到 css 文件的顶部

最佳答案

尝试在 CSS 中添加以下内容

.nav li > a { display: block;}

关于html - css 背景图像 css 不适用于 ul 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28848635/

相关文章:

jquery - Bootstrap 约束宽度 div 包含在 div 中

javascript - 如何更新网页表格行中数据的相应字段?

html - 文本区域中的 Angular 2 多种字体颜色

css - 输入字段 css 问题 - 适用于 chrome/ff 等但不适用于 IE

javascript - 定位鼠标相对于变换平面的位置

html - div 内容溢出到另一个 div 之外

javascript - Modal Div 不是从 javascript 调用

html - 导航没有正确 float

html - CSS :hover doesn't work with IE in SharePoint

html - 哪些是第一个支持滚动条样式的浏览器版本