简体   繁体   中英

background-size: cover doesn't work for height

I have to make a wallpaper and stretch it to the screen, the CSS3 cover doesn't really help VERTICALLY

background-size: 100% 100%;

I saw some post but they didn't work with me.

This is my code :

background-image: url('/wallpapers/img.jpg');
background-repeat:  no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;

Any Idea please ?

you have some syntax errors, the right code is

body {
    background-image: url("/wallpapers/img.jpg");
    background-size: cover;}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM