How to Make Background Image to Cover Whole Browser Window

Sometimes there is a situation, when we don’t have the right background image to cover whole area of site’s window for all resolutions. Here’s a quick CSS reference to make background image resize to whole screen.

background:#233d4b url(../i/bg.jpg) no-repeat 50% 50% fixed;
background-size: 100% 100%;
-moz-background-size: 100% 100%; /* Firefox 3.6 */
-o-background-size: 100% 100%; /* Opera 9.5 */
-webkit-background-size: 100% 100%;/* Safari 3.0 */
-khtml-background-size: 100% 100%; /* Konqueror 3.5.4 */

This works in all browsers except Internet Explorer, versions lower than 9.

 

Share:
This entry was posted in CSS CheatSheets and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *