Сделать чтобы на кнопку не действовал фон

.gl{
  width: 300px;
  height: 300px;
  display: inline-block;
  max-width: 300px;
  max-height: 200px;
  background-color: #fff;
  position: relative;
  background-image: url('https://i.ibb.co/QfLmLrT/image.jpg');
  background-repeat: no-repeat;
  background-size: contain;
 }
.gl:before{
  content: '';
  position: absolute;
  background-color: rgba(0,0,0, .5);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
a{
  color: red;
  font-size: 30px;
  cursor: pointer ;
}
<div class="gl">
  <button>Know More</button>
</div>


Ответы (1 шт):

Автор решения: Vasily

Вам достаточно переместить кнопку на верхний слой, выше слоя с фоновым изображением и маской:

.gl {
  width: 300px;
  height: 300px;
  display: inline-block;
  max-width: 300px;
  max-height: 200px;
  background-color: #fff;
  position: relative;
  background-image: url("https://i.ibb.co/QfLmLrT/image.jpg");
  background-repeat: no-repeat;
  background-size: contain;
}

.gl::before {
  content: "";
  position: absolute;
  background-color: rgba(0, 0, 0, 0.5);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

button {
  position: relative;
  z-index: 1000; 
}
<div class="gl">
  <button>Know More</button>
</div>

→ Ссылка