InsideDarkWeb.com

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

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

Stack Overflow на русском Asked by Leks on November 15, 2021

1 Answers

One Answer

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

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

Answered by Vasily on November 15, 2021

Add your own answers!

Related Questions

Бот телеграм на вебхуке

1  Asked on February 19, 2021 by sova-kefirova

     

Query failed: ERROR: invalid input syntax for type json

1  Asked on February 18, 2021 by jamesjgoodwin

   

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.