css IE6 position:fixed (固定定位)通过position:absolute的解

ie6 position:fixed (固定定位)通过position:absolute的解决方案,完全使用position:absolute来解决固定定位问题。因为其他的浏览器都支持绝对定位,在ie6,7,8,9,ff,chrome中均测试通过。注意一点:不能给外包含的元素mod-test设置高度,不然的话,是没有滚动条的。而应该在里面设置一个容器,它设置一个高度

 <!doctype html public “-//w3c//dtd xhtml 1.0 transitional//en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd”>
 2 <html xmlns=”http://www.w3.org/1999/xhtml”>
 3 <head>
 4 <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
 5 <title>ie6 position:fixed bug</title>
 6 <style type=”text/css”>
 7 body { height:100%; overflow:hidden;  position:relative;}
 8 html { height:100%; overflow:hidden;}
 9 .test{position:absolute;top:100px;left:100px;padding:2px;border:1px solid #aaa;}
10 .mod-test{
11 height:100%;
12 overflow:auto;   
13 }
14 .inlet{
15 height:1800px;
16 }
17 </style>
18 </head>
19 <body>
20 <div class=”mod-test”>
21 <div class=”inlet”>
22   <h1>
23   <a href=”” title=”ie6 position:fixed bug” rel=”bookmark”>ie6 position:fixed bug</a>
24   </h2>
25    <div class=”test”>
26    <img src=”dj.jpg”/><br/>我一直在的
27    </div>
28    </div>
29 </div>
30 </body>

css IE6 position:fixed (固定定位)通过position:absolute的解

相关文章:

你感兴趣的文章:

标签云: