【发布时间】:2016-05-08 08:25:57
【问题描述】:
我有一个组件,它创建了一个内部有一个孔的形状,该组件具有纯色背景,我希望该孔在其下方显示背景图像(因此它看起来像一个实际的孔)。
降价会是这样的:
<body>
<div class="component">
<div class="hole"></div>
</div>
</body>
还有样式:
body {
background-image: url(some-image.jpg);
background-size: cover;
}
.component {
background: black;
height: 200px;
width: 200px;
position: relative;
}
.component .hole {
background: transparent !important; // not sure
height: 20px;
width: 20px;
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
可以吗?有什么解决办法吗?
编辑
根据要求,您可以找到组件here
狗牌有纯色背景,上面的洞应该显示下面的背景。
您也可以在my repo 中找到代码:body styles、dogtag styles、home markup 和dogtag markup。
【问题讨论】:
标签: html css styles background-image