Place H2 and button over CSS image

Asked

Viewed 350 times

0

I am developing a web application and would like to put the title <h2> and a button on an image but when placing the title and button the image misaligns down.

inserir a descrição da imagem aqui

Link to my application

  • I want the image to be inside those black edges ,and the title and button on the image

1 answer

0


Create a class and place the text and button inside it to separate them from the image:

<span class="bot_comprar">
   <h2>Bolos até R$30,00</h2>
   <button type="button" class="comprar_botao">Comprar</button>
</span>

In CSS, add:

*{
   position: relative;
}

.bot_comprar{
   position: absolute;
   top: 0;
   left: 0;
   z-index: 9;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.