图片与文字半透明效果 鼠标移上不透明

  作者:bea

该 DIV是半秀明状态,这样可以看到背景也可以衬托文字,当鼠标放到文字上的时候,DIV层彻底不透明,文字清淅显示出来,一般这种效果都是要配合JavaScript的,这样兼容性会更好。 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="htt
该 DIV是半秀明状态,这样可以看到背景也可以衬托文字,当鼠标放到文字上的时候,DIV层彻底不透明,文字清淅显示出来,一般这种效果都是要配合JavaScript的,这样兼容性会更好。



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片与文字结合的半透明效果,鼠标移上不透明</title>
<style type="text/css">
.box{ width:600px; height:600px; padding:20px;}
*{ margin:0; padding:0;}
body{ background:url(http://files./demoimg/200910/wall.gif) no-repeat; width:300px; height:235px;}
.in_box{background:#fff; width:293px; background:rgba(255,255,255,0.4); filter:alpha(opacity=40); }
.box .sub_con{ position:relative; color:#00F; width:100%;}
.ff{background:#fff; width:293px; background:rgba(255,255,255,1); filter:alpha(opacity=100);}
</style>
</head>
<body>
<div class="box">
<div class="in_box" id="in_box">
<p class="sub_con">(http://)提供各类编程源码、书籍教程、JavaScript/CSS特效代码等,做有质量的学习型网站。</p>
</div>
</div>
<script type="text/javascript">
var hh=document.getElementById('in_box');
var bb;
hh.onmouseover=function(){
bb=this.className;
this.className='ff';
}
hh.onmouseout=function(){
this.className=this.className.replace('ff',bb);
}
</script>
</body>
</html>




[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]



有用  |  无用

猜你喜欢