[How to] Stretch background image for div, body, or other HTML element

Started by Xhanch Studio, October 04, 2012, 12:37:18 PM

previous topic - next topic
Go Down

Xhanch Studio

With CSS 3, now you can stretch background image for a body, div element or other HTML element.

Here are the CSS codes:
Code Select
html,
body,
div{
    width:100%;
    height:100%;
    position:relative;
    background: url(img/bg.jpg) no-repeat center center;
    -webkit-background-size:cover; /*for webKit*/
    -moz-background-size:cover; /*Mozilla*/
    -o-background-size:cover; /*opera*/
    background-size:cover; /*generic*/
}
Best Regards,
Susanto B.Sc
----------------------------------------------------------------------------
Web development services, WordPress plugin and theme development, PSD to XHTML conversion - http://xhanch.com
Read free manga online - http://authrone.com

Go Up