[英]CSS selector not working, show div on parent hover
The CSS selector I am using to show a div on hover of a parent div isn't working. 我用来在父div悬停时显示div的CSS选择器不起作用。 Do I have an error in my CSS?
我的CSS是否有错误?
Thanks. 谢谢。
HTML: HTML:
html body div.left-cont { position: relative; float: right; clear: none; display: block; width: -webkit-calc(100% - 100px); width: -o-calc(100% - 100px); width: -moz-calc(100% - 100px); width: calc(100% - 80px); height: 1000px; margin: 0 10px 0 0; padding: 0; z-index: 8; } html body div.left-cont div.item { position: relative; float: left; clear: none; display: block; width: 48%; height: 200px; margin: 10px 1% 0 1%; padding: 0; -webkit-border-radius: 2.7px; -moz-border-radius: 2.7px; border-radius: 2.7px; overflow: hidden; background-color: #e9e9e9; } html body div.left-cont div.item div.hover { position: relative; float: right; clear: none; display: block; width: 100px; height: 200px; margin: 0 0 0 0; padding: 0; opacity: 0; background-color: orange; } html body div.left-cont div.item:hover ~ div.hover { opacity: 1; }
<div class="left-cont"> <div class="item animate"> <div class="hover animate"> </div> </div> </div>
How about this i changed html body div.left-cont div.item:hover div.hover
我怎么改变了
html body div.left-cont div.item:hover div.hover
html body div.left-cont { position: relative; float: right; clear: none; display: block; width: -webkit-calc(100% - 100px); width: -o-calc(100% - 100px); width: -moz-calc(100% - 100px); width: calc(100% - 80px); height: 1000px; margin: 0 10px 0 0; padding: 0; z-index: 8; } html body div.left-cont div.item { position: relative; float: left; clear: none; display: block; width: 48%; height: 200px; margin: 10px 1% 0 1%; padding: 0; -webkit-border-radius: 2.7px; -moz-border-radius: 2.7px; border-radius: 2.7px; overflow: hidden; background-color: #e9e9e9; } html body div.left-cont div.item div.hover { position: relative; float: right; clear: none; display: block; width: 100px; height: 200px; margin: 0 0 0 0; padding: 0; opacity: 0; background-color: orange; } html body div.left-cont div.item:hover div.hover { opacity: 1; }
<div class="left-cont"> <div class="item animate"> <div class="hover animate"> </div> </div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.