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
    • 273
    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'

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

    with the following CSS:

    1. #background {
    2. width: 100%;
    3. height: 100%;
    4. position: absolute;
    5. left: 0px;
    6. top: 0px;
    7. z-index: 0;
    8. }
    9.  
    10. .stretch {
    11. width:100%;
    12. height:100%;
    13. }

    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
Reset Password
Fill out the form below and reset your password: