How to display a gif fullscreen for a webpage background?

user3264048 picture user3264048 · Feb 5, 2014 · Viewed 158.5k times · Source

I'm trying to make a GIF fit my whole screen, but so far its just a small square that is on my screen while the rest is white. However, I want it to take up all the space.

Any ideas?

Answer

Juan picture Juan · Feb 5, 2014

if it's background, use background-size: cover;

body{
    background-image: url('http://i.stack.imgur.com/kx8MT.gif');
    background-size: cover;
    
    
    
    height: 100vh;
    padding:0;
    margin:0;
}