Full Screen Responsive Background

Full Screen Responsive Background

Full Screen Background

The majority of people would achieve this effect by implementing jquery and a third party plug-in. The code I’m about to explain is just CSS which delivers the same results. The code looks like this.

1
2
3
4
5
6
7
8
9
10
11
html {
    min-height: 100%;
    background-size: cover;
    background-image: url(test.jpg);
    background-repeat: no-repeat;
    background-position: right bottom;
}

body{
    min-height:100%;
}

The interesting CSS attribute we are using is “Background-Size:Cover”, this attribute scales the image to the smallest size such that both its width and its height can fit inside the content area.

Check Out The Demo

You can see how it performs by checking the demo below.

Try it out for yourself, feel free to post up your examples in the comments area below.

Conclusion

Thanks for taking part in this quick tutorial, if you have any questions feel free to post them up on our Facebook Fan Page Or Tweet them via twitter @photoshop_plus.

About the Author Wilma Hamlin

Wilma Hamlin is a creative designer & writer. She writes for Crayonify. Being a designer as well she use to create amazing designs using many tools. In her lesuire time she love to read books and tries to learn new designs.

Leave a Comment:

9 comments
Umair says

Hy thanks dude it is the same thing which I was looking for since i’m not on advance level of web design so far. But I have little a confusion here is that you put one of a CSS3 property as Background-size.. I want to ask that what if we consider the browser compatibility on this? One more thing is that you picked-up a large image about thousand x thousands of pixels.. what if we got a small image as standard 1024×768 of pixels.. the same thing will be worked on that?

Many thanks.. it was a useful stuff which I have got by your site after joining your facebook page as todya :)

Reply
Richard Carpenter says

The background-size property is supported in IE9+, Firefox 4+, Opera, Chrome, and Safari 5+.

There are two types of background-size you can use.

“Cover” Explained above or “Contain”

“Contain” Scales the image to the largest size such that both its width and its height can fit inside the content area.

There are many other techniques.
Try here http://css-tricks.com/perfect-full-page-background-image/

Reply
Julia Agnes says

Hi! Thank you for this tip! I was surfing the web a lot looking for it :)

Reply
Akkis says

So nice tutorial. Thanks for the help.

Reply
Dave says

That is pretty awesome, no JavaScript or jQuery. Just good ol CSS

Reply
Brendon says

This is a great tutorial – a simple, elegant, graceful way to achieve a really nice effect. Good job!

Reply
yashu says

cal u tell image size for this….??

Reply
hali alduhoky says

nice code i used this code for all my sites :) thank you

Reply
serg says

osome tut, I implemented it on my “Under Construction” homepage. Check it out ;)

Reply
Add Your Reply

Popular posts

css.php