<div class="container">
  <div class="box">box1</div>
  <div class="box box2">box2</div>
  <div class="box box3">hover me</div>
</div>
.box {
  width: 100px;
  height: 100px;
  background: green;
  margin: 0 auto;
  margin-bottom: 10px;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

.box2 {
  opacity: 0.5;
}

.box3 {
  position: relative;
}

.box3:hover {
  color: green;
  &::after {
    content:'box3';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    opacity: 0.65;
    color: white;
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.