Posted By

neoline on 07/07/11


Tagged

css resize background


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

spee66


Auto-resizable Background


 / Published in: CSS
 

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

  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. }

Report this snippet  

You need to login to post a comment.