CSS DIV间隔浏览器底部100PX

html-css017

CSS DIV间隔浏览器底部100PX,第1张

/*fixed 兼容解决方案*/

* html{ 

    background-image:url(about:blank) background-attachment:fixed 

}

 

/*距离顶部固定位置(表达式里面的y可以换成某个数值。距离为10px就写10)*/

.fixed-top{

    position: fixed top:0px _top:expression(eval(document.documentElement.scrollTop+y))

}

/*距离底部部固定位置(表达式里面的y可以换成某个数值。距离为10px就写10)*/

.fixed-bottom{

    position: fixed bottom:0px _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)-y)) }

     

.fixed{

    _position: absolute _bottom: auto

}

样式里面那个y.就是个距离值。根据你要设置的大小相应的进行更改。

对应的元素<div class="fixed-bottom fixed"></div>

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:.sub{margin-top: 30px}。

3、浏览器运行index.html页面,此时3个div子子容器的垂直间距被统一设置为了30px。