相关疑难解决方法(0)

如何申请孩子:悬停但不是父母:悬停

使用以下html,当我将鼠标悬停在子项上时,我获得了父项的绿色背景.我怎么能阻止这种情况发生?如果我在子元素之外盘旋,我确实想要绿色背景.

CSS3很好.

.parent {
  padding: 100px;
  width: 400px;
  height: 400px;
}

.parent:hover {
  background-color: green;
}

.child {
  padding: 100px;
  width: 200px;
  height: 200px;
}

.child:hover {
  background-color: blue;
}
Run Code Online (Sandbox Code Playgroud)

css hover

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

css ×1

hover ×1