How to fill an html element with an image?

0

Good morning! I'm doing the front-end of a web app, and I'd like to fill in the buttons and nav-tab with images. What would be the attribute, or the appropriate CSS rule, for the image to "stretch" and adapt to the size of the object? The idea is that the images act in a "responsive" way.

Thanks!

    
asked by Christian Barcelo 16.06.2017 в 15:31
source

2 answers

1

In HTML you put a value on the button:

button value="botonimagen"
ó
input type="button" value="botonimagen"

In the CSS you place the background to the value placed in the HTML:

.botonimagen{
  background-image:url(imagen.jpg);
}
    
answered by 16.06.2017 в 17:53
0

If you are going to do CSS, you could do it through background-cover:

background-image: url("..");
background-size: cover;

More information: link

    
answered by 16.06.2017 в 17:49