2

.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>

0

1 ответ 1

3

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

.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>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.