仅使用CSS在将div悬停时更改主体bgcolor

仅使用CSS在将div悬停时更改主体bgcolor,第1张

仅使用CSS在将div悬停更改主体bgcolor

纯CSS实验:

HTML

<div id="trigger"></div><div id="bg"></div>​

CSS

body {    height: 100%;}#bg {    position: absolute;    top: 0;    right: 0;    bottom: 0;    left: 0;    widht: 100%;    height: 100%;    z-index: 1;    background: #EEE;}#trigger {    position: absolute;    width: 200px;    height: 136px;    top: 50%;    left: 50%;    margin: -68px 0 0 -100px;    background: #333;    z-index: 2;}#trigger:hover ~ #bg {    background: #EE0;}​


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/zaji/5621359.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存