「使用者:Xacid」修訂間的差異
出自 MozTW Wiki
(position:fixed 的使用) |
|||
| 行 1: | 行 1: | ||
| + | 其實不知道要寫什麼,就隨便放一些筆記。 | ||
| + | |||
| + | == 關於網頁技術 == | ||
=== position:fixed 的使用 === | === position:fixed 的使用 === | ||
於 2005年2月27日 (日) 10:53 的修訂
其實不知道要寫什麼,就隨便放一些筆記。
關於網頁技術
position:fixed 的使用
看到一個關於固定圖層的討論,麻煩的是 IE 不能用 position:fixed ,還會把 body 多加空的捲軸;而 Firefox 不能使用滑鼠滾輪捲動 overflow:scroll 製造的捲軸。於是很 dirty 的利用 IE 不能用的 selector ,製造出固定的圖層,而且在 Firefox 中也可以用滑鼠捲動。其實根本是純粹無聊, IE 沒有的東西不要管他就好了。
<html>
<head>
<style type="text/css">
<!--
body{
padding:0;
margin:0;
overflow:auto;
}
#main{
position:absolute;
height:100%;
width:100%;
overflow:auto;
}
body > div#main{
height:auto;
overflow:visible;
}
#fixed{
position:absolute;
top:100px;
right:100px;
z-index:100;
background-color:#aaaaff;
}
body > div#fixed{
position:fixed;
}
-->
</style>
</head>
<body>
<div id="fixed">
<h1>Fixed!</h1>
</div>
<div id="main">
*********************<br />
*********************<br />
*********************<br />
*********************<br />
(repeats)
</div>
</body>
</html>
