我有一个div并将:before
和:after
应用于图像作为内容。那很好。现在,我需要应用背景图像,以便随着div
调整大小而重复,但似乎不起作用。 :before
和:after
上的背景图像是否应该正常工作?
当前代码:
HTML:
<div id="videos-part">test</div>
CSS:
#videos-part{
background-color: #fff;
height: 127px;
width: 764px;
margin: -6px 0 -1px 18px;
position: relative;
}
#videos-part:before{
width: 16px;
content: " ";
background-image: url(/img/border-left3.png);
position: absolute;
left: -16px;
top: -6px;
}
最佳答案
@michi;在height
伪类中定义before
CSS:
#videos-part:before{
width: 16px;
content: " ";
background-image: url(/img/border-left3.png);
position: absolute;
left: -16px;
top: -6px;
height:20px;
}
关于css - :before和background-image ...应该可以吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7203697/