實現一個層固定在底部,隨滾動條滾動(1.
<body scroll="no" style="margin:0px">
<div style="height:expression(document.body.clientHeight);overflow:auto;">
<div style="height:2000px">稱大頁面</div>
</div>
<div style="height:100px;background-color:#AA;position:relative;top:-100px;z-index:-1">bottom</div>
</body>
實現一個層固定在底部,隨滾動條滾動(2.
<!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 type="text/css">
#fixed{position:fixed;top:5em;right:0;......} 針對IE7、Opera、Firefox一行搞定
</style>
IE6中利用容器對溢出內容的處理方式來實現的
<!--[if IE 6]> 利用IE獨有的條件語句可以針對不同的IE版本精確設置,同時避免了這些代碼被其他瀏覽器讀到
<style type="text/css">
html{overflow:hidden;}
body{height:100%;overflow:auto;}
#fixed{position:absolute;right:17px;}
fixed元素的絕對位置是相對于HTML元素來說,而滾動條是body元素的,這是設置right:17px的原因
</style>
<![endif]-->
<!--[if lt IE 6]>
<style type="text/css">
#fixed{position:absolute;top:expression(eval(document.body.scrollTop + 50));}
</style>
<![endif]-->
</head>
<body>
<div id="wrapper">
......
</div>
<div id="fixed"><h2>{position:fixed}</h2></div>
</body>
</html>
分享標題:網站設計中css樣式使用技巧
分享路徑:http://m.2m8n56k.cn/news37/197837.html
網站建設、網絡推廣公司-創新互聯,是專注品牌與效果的網站制作,網絡營銷seo公司;服務項目有網站設計等
廣告
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源:
創新互聯