所以我正在制作这个使用 :before 作为图标的 tumblr 主题,如下所示:
/* Icons */
ol#posts li:before{
content:"";
display:block;
position:absolute;
left:-46px;
width:32px;
height:24px;
background-repeat:no-repeat;
// tried: overflow:visible;
}
li.text:before{
background:url('http://i.imgur.com/z5YtE.png');
}
[...]
但是当我将li.post的overflow设置为auto时,图标就不会显示了。
li.post{
position:relative;
max-height:400px;
overflow-x:auto;
}
造成这种情况的原因是什么以及如何解决它?
谢谢:)
最佳答案
您可能会给自己答案:“当我将 li.post 的溢出设置为自动时,图标将不会显示。”
删除溢出-x
您正在做的是,如果内容多于未定义的宽度,则显示滚动条。
您还没有设置with,因此滚动条永远不会显示,并且不在容器li.post普通 View 中的所有图标都不可见(因为绝对定位)。
关于css - :before not showing when overflow is auto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11916650/