Home  »  CodeSnippets   »   Make CSS Background Image Fit Screen

Make CSS Background Image Fit Screen

Posted: March 5, 2022 | by Site Host

CSS background-image fit screen.

body {
   background-image: url(images/background.jpg);
   background-size: cover;                   
   background-repeat: no-repeat;
   background-position: center center;
}

CSS background-image cover using a shortcut.

html { 
   background: url(images/background.jpg) no-repeat center center fixed; 
   -webkit-background-size: cover;
   -moz-background-size: cover;
   -o-background-size: cover;
   background-size: cover;
}

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

See also  How to Change Font Width and Height of Text