ãããã¼ã¨ããã¿ã¼ãåºå®ãã¦ãPNGã®ééç»åãç¨ãã¦ç«ä½çã«è¦ããï¼IE6対å¿ï¼
ããªã¨ã¼ã·ã§ã³ã¨ãã¦è¦ãã¦ãããã¨æãã
HTMLã¨CSSã ãã§ããããã¼ã¨ããã¿ã¼ãåºå®ãã¦è¡¨ç¤ºãããã«ã¯CSSã®positionããããã£ã§fixedãè¨å®ããã
ããã¯é²è¦§è
ã®ãã©ã¦ã¶ã«å¯¾ãã¦åºå®ããä½ç½®ã«é
ç½®ãããã¨ãã§ããã®ã§ãã¹ã¯ãã¼ã«ãã¦ãé
ç½®ããããªãããã«ãããã¨ãã§ããã
CSSã ã¨ãããªæã
body { margin: 0px; padding: 0px; } #header { position: fixed; top: 0px; left: 0px; width: 100%; height: 100px; } #footer { position: fixed; bottom: 0px; left: 0px; width: 100%; height: 100px; }
ãã ãããã ã¨IE6以ä¸ã®å ´åä¸æã表示ãããªãã
ãã®ãããIEã®ç¬èªæ¡å¼µCSSã追å ããã
body { margin: 0px; padding: 0px; /* IE6対çï¼ã¹ã¯ãã¼ã«æã®è¡¨ç¤ºãã¬é²æ¢ï¼ */ background-image : url("dummy"); background-attachment: fixed; } #header { position: fixed; top: 0px; left: 0px; width: 100%; height: 100px; /* IE6対çï¼ä½ç½®åºå®ï¼ */ _position: absolute; _top: expression(eval(document.documentElement.scrollTop+0)+'px'); } #footer { position: fixed; bottom: 0px; left: 0px; width: 100%; height: 100px; /* IE6対çï¼ä½ç½®åºå®ï¼ */ _position: absolute; _top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-100)+'px'); /* é«ã100pxã®å ´å */ }
ãããªæãã
HTMLã¯ãããªæãã
<body> <div id="header"> ãããã¼ </div> <div id="main-container"> ã³ã³ãã³ã </div> <div id="footer"> ããã¿ã¼ </div> </body>
次ã«ãCSSã§èæ¯ç»åã§ééPNGã使ãå ´åã®IE6対å¿ã
æè¿ã§ã¯IE6ã«ééPNGã表示ããããã¼ã«ãããããããã¾ãããä»åã¯ãDD_belatedPNGãã使ãã¾ãã
ããã®è¯ãã¨ããã¯CSSèæ¯ééç»åã®ãªãã¼ãã«å¯¾å¿ãªã©ãä»ã®ãã¼ã«ã«ãªãæ§ã
ãªå¯¾å¿ãå®ç§ã«ã§ãã¦ãã¾ãã
ã¨ãããã¨ã§ãheadã§ãã®JSãèªã¿è¾¼ãã§ãééãããã»ã¬ã¯ã¿åãè¨è¿°ãã¾ãã
<!--[if IE 6]> <script src="DD_belatedPNG.js"></script> <script>DD_belatedPNG.fix('#header, #footer');</script> <![endif]-->
ããã§å®ç§ï¼
ãサンプルで作ったページã
ãã¨ã¯z-indexããããã£ã§éãããããã°ãããç«ä½çãªè¡¨ç¾ãã§ãã¾ãã