網(wǎng)站設計中css樣式使用技巧

2022-09-24    分類: 網(wǎng)站設計

實現(xiàn)一個層固定在底部,隨滾動條滾動(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>
實現(xiàn)一個層固定在底部,隨滾動條滾動(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中利用容器對溢出內(nèi)容的處理方式來實現(xiàn)的
<!--[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>

分享標題:網(wǎng)站設計中css樣式使用技巧
分享路徑:http://www.muchs.cn/news37/197837.html

網(wǎng)站建設、網(wǎng)絡推廣公司-創(chuàng)新互聯(lián),是專注品牌與效果的網(wǎng)站制作,網(wǎng)絡營銷seo公司;服務項目有網(wǎng)站設計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設