다음 스크립트의 #box 및 #internalArrow 요소의 배경색을 a : hover {background-color : rgb (189, 64, 132);} 구조.CSS를 사용하여 중첩 된 요소의 배경색 변경 : a hover
이것은 내가 가지고있는 것입니다.
<style type="text/css">
#box
{
background-color: rgb(217, 9, 122);
height: 50px;
width: 50px;
position: absolute;
top:50%
}
#box:after {
content: ' ';
height: 0;
position: absolute;
width: 0;
border: 20px solid transparent;
border-right-color: #ffffff;
top: 50%;
left: 10%;
margin-left:-15px;
margin-top:-20px;
}
#internalArrow
{
width:0;
height:0;
position:absolute;
border: 20px solid transparent;
border-right-color: rgb(217, 9, 122);
top: 50%;
left: 10%;
margin-left:-5px;
margin-top:-20px;
z-index:100;
}
#box:hover + #internalArrow
{
background-color:rgb(189, 64, 132);
}
#wrapper
{
height:600px;
width:50px;
background-color:#ffffff;
opacity:0.9;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="box">
<a id="anchor" href=""><div id="internalArrow"></div></a>
</div>
</div>
</body>
나는이 이전 대답 On a CSS hover event, can I change another div's styling?을 사용했지만 나에게 적합하지 않습니다. Chrome과 Firefox에서 사용해 보았습니다. 어떤 아이디어? 감사합니다. . 당신의 CSS에서
+를 꺼내면 작동합니다. –