图片与文字半透明效果 鼠标移上不透明
作者: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需刷新才能执行]
有用 | 无用
<!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需刷新才能执行]
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- JavaScript 自动完成脚本整理(33个)
- javascript 添加和移除函数的通用方法
- JS 用6N±1法求素数 实例教程
- 获取网站跟路径的javascript代码(站点及虚拟目录)
- JavaScript 点击插入文字
- 单选按钮决定链接的网址
- 让链接必须按先后顺序点击的JS代码
- Js文字背景行如流水特效
- 一个链接按两种方式打开两个网址的方法
- 随日期每天自动变换的文本的js特效
- Js 实现文字爬楼滚动效果 结合文本框
- JS CSS制作饱含热情的镶边文字闪烁特效
- Javascript var变量隐式声明方法
- 让你的网站可编辑的实现js代码
- javascript 表单中浏览文件的“浏览”按钮修改
- Javascript 仿歌词智能滚动代码
- JS、CSS文字切换,定时交替,代码精简
- 纯CSS 链接悬停提示效果代码
- javascript 模拟Marquee文字向左均匀滚动代码