【发布时间】:2013-11-08 00:49:38
【问题描述】:
我在div 中有三个彩色框,所有颜色都不同,当我 hover 在其中任何一个框上时,我必须使父 div 的 background-color 出现与悬停在上面的内盒。
CSS:
.t1_colors {
float: left;
width: 100px;
height: 100px;
margin-right: 20px;
border: 1px solid rgb(111,61,69);
}
HTML:
<div id="task1" class="task">
<h2>Task 1</h2>
<p>Change the background color, of the div that contains this task, to the color in each box when the box is hovered over.</p>
<p>When the mouse stops hovering over the box, change the background color back to white.</p>
<div id="t1_color_one" class="t1_colors" style="background: goldenrod;"></div>
<div id="t1_color_two" class="t1_colors" style="background: lightgreen;"></div>
<div id="t1_color_three" class="t1_colors" style="background: palevioletred;"</div>
</div>
我们的班级正在使用addEventListener,如果这样可以让任何事情变得更容易的话。提前感谢您的任何反馈,我们将不胜感激。
【问题讨论】:
标签: javascript html css colors hover