現(xiàn)在有一個(gè)嵌套的結(jié)構(gòu)<style>
div{ display: inline-block; margin: 50px;} .box-3{ width: 200px; height: 200px; background: pink} .box-2{ background:rgb(113, 160, 179)} .box-1{ background:thistle} div:hover{ outline:2px dashed rebeccapurple}</style><div class="box-1">
<div class="box-2">
<div class="box-3"></div>
</div></div>我想實(shí)現(xiàn)的效果是經(jīng)過(guò)哪個(gè)元素哪個(gè)元素就有hover效果,實(shí)際情況是當(dāng)hover到子元素時(shí),父元素也會(huì)觸發(fā)hover效果,有點(diǎn)類似js中的冒泡請(qǐng)問(wèn)有沒(méi)有css的解決方式呢?注:js可以實(shí)現(xiàn),不需要js實(shí)現(xiàn)方法,謝謝下面是js實(shí)現(xiàn)demohttps://codepen.io/xboxyan/pe...
css中hover的問(wèn)題
幕布斯7119047
2018-09-23 20:25:35