CSS實現div固定於網頁右下角執行個體代碼,cssdiv

來源:互聯網
上載者:User

CSS實現div固定於網頁右下角執行個體代碼,cssdiv

CSS實現div固定於網頁右下角執行個體代碼:
將一個元素固定於網頁右下角的效果使用非常頻繁,比如返回頂部的按鈕,或者說是資訊氣球之類的,下面就介紹一下如何使用CSS實現此效果,代碼執行個體如下:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>螞蟻部落</title><style type="text/css">*{  padding:0;  margin:0;}body{height:1000px;}#footer{  position:fixed;  background:#eee;  bottom:20px;  right:10px;  width:100px;  height:100px;}</style></head><body><div id="footer"></div></body></html>

以上代碼實現了我們的要求,div塊能夠固定在網頁右下角部位,無論是否拖動捲軸,但是此代碼有一個缺陷,那麼就是IE6並不支援position:fixed,不過在不就之後IE6自然會消失匿跡,也就無需有此顧慮了。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=9737

更多內容可以參閱:http://www.softwhy.com/divcss/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.