Background Images does not work in Android, BB, Windows Phone

advertisements

My Background Images was not working in Android, BB, Windows Phone. I want Common Code that want to support all Android, BB, windows Phone.

And also the Image Must Be Stretch Automatically based on the screeen size

Can any one please help Me..with some good solution.

Thanks


Ok the problem is that you're not setting a background image. You're using a regular image. To use a background image on your element you can use the following CSS (just note the background line).

Make sure the path to your image is relative to the CSS file. Not the root. Change the repeating and positioning settings accordingly - http://www.w3schools.com/cssref/pr_background-image.asp

    #backgrndImg {
        height: 100%;
        left: 0;
        position: fixed;
        top: 0;
        width: 100%;
        z-index: -1;
        background: url('images/your_image.jpg') no-repeat left top;
   } 

    <div id="backgrndImg"></div >