Home >Web Front-end >CSS Tutorial >How to write couplet advertising code using css
The couplet advertisements provided in this article are completely implemented using CSS and are compatible with all browsers, including various ie, ff, and gg browsers. The code is simple and easy to use.
The code is as follows:
<!-- css 代码--> .couplet_ad /* 底部固定*/ {position:fixed;bottom:auto; top:0; width: 120px; height: 230px; z-index:99999; margin-top:158px;} html .couplet_ad /* IE6 底部固定*/ {_position:absolute; _bottom:auto; _top:expression(eval(document.documentElement.scrollTop));} .couplet_ad a{ display:block; cursor:pointer;} #ad_left{ left: 0px;} #ad_right{ right: 0px;} <!-- html代码 --> <!-- 对联广告左边 --> <div class="couplet_ad" id="ad_left"> <a target="_blank" href=""><img src="dl.jpg"></a> <a onClick="ad_left();">关闭</a> </div> <!-- 对联广告右边 --> <div class="couplet_ad" id="ad_right"> <a target="_blank" href=""><img src="dl.jpg"></a> <a onClick="ad_right();">关闭</a> </div> <!-- js关闭按钮代码 --> <script language="javascript"> function ad_left(){ document.getElementById('ad_left').style.display="none"; } function ad_right(){ document.getElementById('ad_right').style.display="none"; } </script>
Related recommendations:
js couplet ads under div css do not scroll with the screen Solution_html/css_WEB-ITnose
How to modify the global couplet advertisement of Discuz X2
javascript couplet advertisement Compatible with IE FF
The above is the detailed content of How to write couplet advertising code using css. For more information, please follow other related articles on the PHP Chinese website!