Home  >  Article  >  Web Front-end  >  CSS实现div固定于网页右下角实例代码_html/css_WEB-ITnose

CSS实现div固定于网页右下角实例代码_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:31:031380browse

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/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn