Jer*_*ter 6 css css3 windows-8
我试图从Windows 8 ListView控件中的.win-container元素(tile)中删除白色背景,让背景显示出来.当我跟踪样式时,我可以看到白色背景正在应用以下规则......
.win-listview :not(.win-footprint).win-container
Run Code Online (Sandbox Code Playgroud)
所以我就这样写了我自己的规则......
.win-listview :not(.win-footprint).win-container {
background-color: none;
}
Run Code Online (Sandbox Code Playgroud)
但那没用.
一位朋友帮我弄清楚我可以用......
.win-listview :not(.win-footprint).win-container {
background-color: inherit;
}
Run Code Online (Sandbox Code Playgroud)
这很有效.任何人都可以告诉我为什么在这个世界上是这样的?
none是background-image属性的值,而不是background-color.由于它不是有效值background-color,因此将忽略声明,系统将继续使用默认的白色背景绘制切片.如果您想为瓷砖提供透明背景,则需要使用background-color: transparent:
.win-listview :not(.win-footprint).win-container {
background-color: transparent;
}
Run Code Online (Sandbox Code Playgroud)
(您也可以使用background: none,但同样none代表background-image有一个隐含transparent的background-color.)
background-color: inherit只是告诉你的瓷砖承担(或继承)与ListView包含它们相同的背景颜色.这可能会或可能不具有没有明显背景颜色的明显效果.然而,它与具有透明背景不同(除非它ListView本身也具有透明背景,在您的情况下它可能不具有).