运行代码 缩小
汉王
HTML代码
复制 格式化 注释 注释 清空
放大
AخA
 
1
<!DOCTYPE HTML>
2
<html lang="en-US">
3
<head>
4
<meta charset="UTF-8">
5
<title>IE6下实现CSS固定定位{position:fixed}</title>
6
<style type="text/css">
7
*html{overflow:hidden;}
8
*body{height:100%;overflow:auto;}
9
.content{height:2000px;}
10
.mydiv{width:300px;height:300px;position:fixed;margin-top:-150px;margin-left:-150px;background:#9C0;left:50%;top:50%;_position:absolute;}
11
.return{ margin:10px 30px;padding:5px;background:#ffc;border:1px dashed #ccc;font-weight:700;font-size:14px}
12
.return a{padding-left:5px;font-weight:normal;letter-spacing:1px;text-decoration:none; color:#456;-webkit-transition-duration:1s;border-bottom:1px dashed #4a630f;}
13
.return a:hover{text-decoration:none;color:#063;}
14
</style>
15
</head>
16
<body>
17
</head>
18
<body>
19
<div  id="warp"></div>
20
<div class="content">
21
<div class="mydiv"></div>
22
</div>
23
</body>
24
</html>
CSS代码
复制 格式化 注释 注释 颜色 清空
放大
CSS代码...
x
 
1
JS代码
复制 格式化 注释 注释 清空
放大
JS代码...
xxxxxxxxxx
1
 
1
名称
IE6下实现CSS固定定位{position:fixed}
分类
表格图层
描述
IE6下实现CSS固定定位{position:fixed},绝对定位CSS实现。运行一下代码就会发现它的利害。固定和相对定位,是CSS中两种经常用到的基础技巧,有必要通过这些小实例掌握其实现的原理哦。
收藏