position:fixed; 是fixed的用法,配合overflow实现将一个元素定位到网页的一个位置上面,具体请看下面的例子:

CSS position:fixed; for IE6<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
CSS position:fixed; for IE6
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
CSS position:fixed; for IE6
<head>
CSS position:fixed; for IE6
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
CSS position:fixed; for IE6
<meta name="Author" content="Stu Nicholls"/>
CSS position:fixed; for IE6
<meta name="Keywords" content="Cascading, Style, Sheets, CSS1, CSS2, CSS, XHTML1.1, w3c, doing it with style, recommendations, opacity, box model, mozilla, opera, netscape, internet explorer, v6, v7.23, techniques, layout, three column, cutting edge, experimental, validation, validate, navigation, pop-up, pull-down, menus, tips, tricks, css mouseover, mouseovers, CSS Frames, CSS menu, CSS menus"/>
CSS position:fixed; for IE6
<meta name="Description" content="CSS ~ Cutting edge Cascading Style Sheets. Experiments in CSS"/>
CSS position:fixed; for IE6
<title> CSS position:fixed; for IE6</title>
>

实现兼容IE6的方式:

<!--[if IE 6]>
<style type="text/css">
/*<![CDATA[*/ 
html {overflow-x:auto; overflow-y:hidden;}
/*]]>*/
</style>
<![endif]
-->

CSS的精华部分在:

body {margin:0; padding:0 10px 0 10px; border:0; height:100%; overflow-y:auto; background:#ccc;}

#menu 
{display:block; top:10px; left:10px; width:130px; position:fixed;

* html #menu {position
:absolute;}

相关文章: