1. Question:
parent element has .parent: active
, which changes the background color when clicked. The effect that
wants to achieve is that if you click on a special child element, you don"t want to trigger the parent element to change the background color, but other elements will trigger normally. Could you tell me how to do that? Can pure css
do that? The page structure and style of
demo is as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>(runoob.com)</title>
<style>
.parent{
height: 100px;
background: -sharpccc;
}
.parent:active {
background: -sharpaaa;
}
.no-active{
height: 40px;
width: 40px;
background: -sharp219;
color: -sharpfff;
}
</style>
</head>
<body>
<div class="parent">
<div class="no-acitve">hello</div>
<div class="other">active</div>
</div>
</body>
</html>