<div id="outer-div" onclick="myFunction()">
<div id="intermediate-div">
<div id="inner-div"></div>
</div>
</div>
#outer-div {
height: 200px;
width: 200px;
background: red;
}
#intermediate-div {
height: 150px;
width: 150px;
background: green;
}
#inner-div {
height: 100px;
width: 100px;
background: blue;
}
let myFunction = () => {
event.target.style.background='gray';
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.