不用js多浏览器兼容纯DIV/CSS对联漂浮广告代码
(编辑:jimmy 日期: 2024/11/15 浏览:3 次 )
纯DIV/CSS对联漂浮广告代码(无JS)
源码网两侧漂浮。经测试,兼容IE6,IE7,Firefox浏览器。
CSS代码为:
复制代码 代码如下:
.r1{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:200px;
position:absolute; z-index:300; top:expression(offsetParent.scrollTop+200);right:20px;}
.r2{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:300px;
position:absolute; z-index:400; top:expression(offsetParent.scrollTop+300);right:20px;}
.l1{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:200px;
position:absolute; z-index:300; top:expression(offsetParent.scrollTop+200);left:20px;}
.l2{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:300px;
position:absolute; z-index:400; top:expression(offsetParent.scrollTop+300);left:20px;}
页面代码为:
复制代码 代码如下:
<div class="r1"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif"><div class="r2"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif"><div class="l1"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif"><div class="l2"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif">
源码网两侧漂浮。经测试,兼容IE6,IE7,Firefox浏览器。
CSS代码为:
复制代码 代码如下:
.r1{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:200px;
position:absolute; z-index:300; top:expression(offsetParent.scrollTop+200);right:20px;}
.r2{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:300px;
position:absolute; z-index:400; top:expression(offsetParent.scrollTop+300);right:20px;}
.l1{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:200px;
position:absolute; z-index:300; top:expression(offsetParent.scrollTop+200);left:20px;}
.l2{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:300px;
position:absolute; z-index:400; top:expression(offsetParent.scrollTop+300);left:20px;}
页面代码为:
复制代码 代码如下:
<div class="r1"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif"><div class="r2"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif"><div class="l1"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif"><div class="l2"><a href="https://www.jb51.net" target='_about'><img src="/UploadFiles/2021-04-02/piao-l-1.gif">
下一篇:css强制换行 css强制不换行的css方法