您的位置:首页 > 其它

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

2009-10-18 00:00 330 查看
该 DIV是半秀明状态,这样可以看到背景也可以衬托文字,当鼠标放到文字上的时候,DIV层彻底不透明,文字清淅显示出来,一般这种效果都是要配合JavaScript的,这样兼容性会更好。





图片与文字结合的半透明效果,鼠标移上不透明

.box{ width:600px; height:600px; padding:20px;}
*{ margin:0; padding:0;}
body{ background:url(http://files.jb51.net/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);}





脚本之家(http://www.jb51.net)提供各类编程源码、书籍教程、JavaScript/CSS特效代码等,做有质量的学习型网站。



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);
}


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: