0

I need help to create centered transparent box with text over image. I searched, searched and searched, but I didn't find right answer. Let's say, I have this code:

<div class="grid12-6">

<img src="image-url">
<h2>Fashion Bracelets</h2>
<button>See More</button>

</div>

and I need something like this:

enter image description here

I will be very grateful for any help.

Adam
  • 31
  • 1
  • 4

1 Answers1

1

Created a much similar thing but you might have to do little cosmetic changes.

HTML

<div class="grid12-6">

<img src="https://i.stack.imgur.com/XRN4Y.jpg">
<div class="inner_box">
  <h2>Fashion Bracelets</h2>
  <button>See More</button>
</div>

</div>

CSS

.grid12-6{
  position:relative;
}
.grid12-6 .inner_box{
  position:absolute;
  background:rgba(255,255,255,0.7);
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  padding:35px;
  text-align:center;
}
.grid12-6 .inner_box h2{
  font-family:arial;
  text-align:center;
  font-size:26px;
  font-weight:normal;
  color:#777;
}
.grid12-6 .inner_box button{
  background:#aaa;
  color:#fff;
  text-transform:uppercase;
  font-weight:bold;
  font-size:16px;
  border:none;
  padding:10px 30px;
}

In the above code you dummy image is used change it accordingly and see the result minor font size, color changes might be necessary

Gaurav Aggarwal
  • 9,809
  • 6
  • 36
  • 74