Home  >  Article  >  Web Front-end  >  How to write couplet advertising code using css

How to write couplet advertising code using css

墨辰丷
墨辰丷Original
2018-05-09 16:51:053540browse

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(&#39;ad_left&#39;).style.display="none";
}
function ad_right(){
document.getElementById(&#39;ad_right&#39;).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!

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