Auto-resizable Background


/ Published in: CSS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* Use this markup: */
  2.  
  3. <div id="background">
  4. <img src="img.jpg" class="stretch" alt="" />
  5. </div>
  6.  
  7. */ with the following css: */
  8.  
  9. #background {
  10. width: 100%;
  11. height: 100%;
  12. position: absolute;
  13. left: 0px;
  14. top: 0px;
  15. z-index: 0;
  16. }
  17.  
  18. .stretch {
  19. width:100%;
  20. height:100%;
  21. }

URL: http://stackoverflow.com/questions/376253/stretch-and-scale-css-background/388817#388817

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.