展会信息港展会大全

css IE6 position:fixed (固定定位)通过position:absolute的解决方案
来源:互联网   发布日期:2016-03-25 16:31:01   浏览:2509次  

导读:css教程 ie6 position:fixed (固定定位)通过position:absolute的解决方案,完全使用position:absolute来解决固定定位问题。因为其他的浏览器...

css教程 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>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港