我正在尝试在居中的div内使3个元素间隔76个像素(第一个元素除外)。但是,第一个孩子的伪类似乎并不想强制自己。它一直被原始规则所取代。
JSFIDDLE
的CSS
.buddy-icons {
margin: 0 auto;
}
.buddy-oval-icon {
padding-left: 76px;
height: 60px;
width: 60px;
}
.buddy-icons > [class^="buddy-oval-icon"]:first-child {
padding-left: none;
}
最佳答案
none
是padding-left
的无效值。使用0
代替
.buddy-icons {
margin: 0 auto;
}
.buddy-oval-icon {
padding-left: 76px;
height: 60px;
width: 60px;
}
.buddy-icons > [class^="buddy-oval-icon"]:first-child {
padding-left: 0;
}
<div class="buddy-icons">
<img src="http://images.all-free-download.com/images/graphiclarge/button_blank_red_100846.jpg" class="buddy-oval-icon">
<img src="http://images.all-free-download.com/images/graphiclarge/button_blank_red_100846.jpg" class="buddy-oval-icon">
<img src="http://images.all-free-download.com/images/graphiclarge/button_blank_red_100846.jpg" class="buddy-oval-icon">
</div>
关于css - CSS第一个 child 不工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31199226/