Adjust Background according to resolution

0

I have a background image, and I would like it to fill the div and adjust to the monitor resolution.

The div is already responsive as I use Foundation Zurb.

I did this, but the image does not fit.

background: url('../img/fundos/fundo.png')no-repeat center top;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
    
asked by anonymous 08.03.2017 / 02:12

1 answer

2

I also use Foundation and the following excerpt tested in Chrome and Firefox updated:

// supondo um identificador tipo classe para sua div
.my-div{
   background-image: url(../img/fundos/fundo.png);
   background-attachment: fixed;
   background-repeat: no-repeat;
   background-size: 100% 100%;
}

To learn more about background image properties in CSS3, support and use of prefixes caniuse.com

    
08.03.2017 / 05:48