仿百度联盟对联广告源代码展示,主要使用现代浏览器都支持的position:fixed属性,并专门针对ie6做了最大限度的兼容性处理
源码如下:
*{margin:0;padding:0;} body{height:2000px;} .floatAd{width:124px;height:299px; text-align:center; position:fixed;margin-left:0;top:109px; _position:absolute; background:url(//img.jbzj.com/demoimg/2014/bg_slide2_120_270.png-600) no-repeat;} .floatAd a{display:block;} .floatAd img{border:none;} .floatAd .closeAd{width:50px; height:20px; display:block; cursor:pointer;margin:9px 0 0 auto;} .flAd{left:0;} .frAd{right:0;}
我们还可以改下代码,实现“单边展示飘浮广告,多个广告轮播展示”的效果,更改后的源代码:
*{margin:0;padding:0;} body{height:2000px;} .floatAd{width:124px;height:299px; text-align:center; position:fixed;margin-left:0;top:109px;right:0; _position:absolute; background:url(//img.jbzj.com/demoimg/2014/bg_slide2_120_270.png-600) no-repeat;} .floatAd a{display:block;} .floatAd img{border:none;} .floatAd .closeAd{width:50px; height:20px; display:block; cursor:pointer;margin:9px 0 0 auto;}
以上就是仿百度联盟对联广告实现代码的详细内容,更多请关注本站其它相关文章!