<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.currentTarget.style.background='gray';
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.