Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to scale and strech the image in a fix size?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 231
    Comment on it

    If you have a fixed div and you want the image to be put over it by stretch and scaling then you can use the following code for html and css:-

    In the html page add class 'background' and 'stretch'

    <div id="background">
        <img src="img.jpg" class="stretch" alt="" />
    </div>
    

    with the following CSS:

    #background {
        width: 100%; 
        height: 100%; 
        position: absolute; 
        left: 0px; 
        top: 0px; 
        z-index: 0;
    }
    
    .stretch {
        width:100%;
        height:100%;
    }
    

    And you can put the fixed in place of .stretch width: and height:

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: