首页前端开发CSS图像透明度大法(opacity)

图像透明度大法(opacity)

时间2024-05-25 23:38:03发布访客分类CSS浏览97
导读:定义和用法 opacity 属性设置元素的不透明级别。 语法 opacity: value|inherit; 实例一:创建透明图像 img { opacity:0.4; filter:alpha(op...

定义和用法

opacity 属性设置元素的不透明级别。

语法

opacity: value|inherit;

实例一:创建透明图像





img
{
    
opacity:0.4;
    
filter:alpha(opacity=40);
 /* For IE8 and earlier */
}

img:hover
{
    
opacity:1.0;
    
filter:alpha(opacity=100);
 /* For IE8 and earlier */
}




图像透明度

Peach Blossom

注释:在 IE 中,必须添加 ,这样才能将 :hover 选择器用于除了 之外的其它元素。

实例二:半透明框中加文本

呈现方式





.background
{
    
  width: 400px;
    
  height: 266px;
    
  background: url(http://pic.58pic.com/58pic/15/36/00/73b58PICgvY_1024.jpg) no-repeat ;
    
  border: 1px solid black;

}

.transbox
{
    
  width: 338px;
    
  height: 204px;
    
  margin:30px;
    
  background-color: #ffffff;
    
  border: 1px solid black;
    
  /* for IE */
  filter:alpha(opacity=60);
    
  /* CSS3 standard */
  opacity:0.6;

}

.transbox p
{
    
  margin: 30px 40px;

}
    



This is some text that is placed in the transparent box.This is some text that is placed in the transparent box.This is some text that is placed in the transparent box.This is some text that is placed in the transparent box.This is some text that is placed in the transparent box.

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: 图像透明度大法(opacity)
本文地址: https://pptw.com/jishu/668082.html
怎么查看python的安装路径 Java第三方包导入错误的原因有哪些

游客 回复需填写必要信息