迪拉斯: Bild auf div-Höhe skalieren?

Beitrag lesen

Hey,
du brauchst noch einen Javascripthandler, der bei Größenanderungen des Viewports die Höhe des gestrecktes Bilds neu berechnet und setzt, nämlich auf 100% minus 100px.

  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
  <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title></title>  
    <style type="text/css">  
[code lang=css]  
h1 {  
    position: fixed;  
    top: 0;  
}  
#stretch {  
    position: fixed;  
    top: 100px;  
    width: 100%;  
    height: 100%;  
}  
#stretch img {  
    width: 100%;  
    height: 100%;  
}

</style>
  </head>
  <body>
    <h1>Lorem ipsum</h1>
    <div id="stretch"><img src="bg.png" /></div>
  </body>
</html>
[/code]

--
水-金-地-火-木-土-天-海-冥