很早就看到QZone的顶部工具栏很有趣,想仿一个,谁知QZone的代码太复杂没分析出来就已经晕了```
今天无意中发现搜狐博客用的也是这种浮动在顶部的工具栏就用FireBug分析了一下,呵呵``
搜狐写的倒是挺简单,代码代码已经弄下来叻,其实原理很简单,就是 position:fixed; 起初是尝试做了一下,
因为 z-index 的原因,一直没成功,不过这下终于好了,呵呵~~~需要的自己Copy吧!


[html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
<!--
body{
background:#E0E5E7 none repeat scroll 0 0;
margin:0;
}
.toolbar {
position:fixed;
height:20px;
width:100%;
background-color:#999;
z-index:9999;
}
.content {
margin-top:20px;
}

#div1 {
height:1500px;
background-color:#555;
}
-->
</style>
</head>
<body>
<div>ToolBar!</div>
<div>
<div id="div1">Hello World!</div>
</div>
</body>
</html>
[/html]

标签: Web, CSS