CSS 图像透明度opacity兼容性介绍
建站知识 2021-07-03 08:43www.168986.cn长沙网站建设
以前的兼容
<span class="class">.transparent_class</span> <span class="rules">{
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-ms-filter</span>:<span class="value"><span class="string" style="color:rgb(42,161,152)">"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie8 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">filter</span>:<span class="value"><span class="function">alpha(opacity=<span class="number" style="color:rgb(42,161,152)">50</span>)</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie5-7 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-moz-opacity</span>:<span class="value"><span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ old mozilla browser like scape /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-khtml-opacity</span>:<span class="value"> <span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ for really really old safari /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">opacity</span>:<span class="value"> <span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ css standard, currently it works in most modern browsers like firefox, /</span>
<span class="rule">}</span></span>
现在的兼容
<span class="class">.transparent_class</span> <span class="rules">{
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-ms-filter</span>:<span class="value"><span class="string" style="color:rgb(42,161,152)">"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie8 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">filter</span>:<span class="value"><span class="function">alpha(opacity=<span class="number" style="color:rgb(42,161,152)">50</span>)</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie5-7 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">opacity</span>:<span class="value"> <span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ css standard, currently it works in most modern browsers /</span>
<span class="rule">}</span></span>
<!DOCTYPE html>
<html>
<head>
<style>
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 /
}
</style>
</head>
<body>
<h1>图像透明度</h1>
<img src="/i/tulip_peach_blossom_w_s.jpg" alt="Peach Blossom" />
<p><b>注释</b>在 IE 中,必须添加 <!DOCTYPE>,这样才能将 :hover 选择器用于除了 <a> 之外的其它元素。</p>
</body>
</html>
复制代码
代码如下:<span class="class">.transparent_class</span> <span class="rules">{
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-ms-filter</span>:<span class="value"><span class="string" style="color:rgb(42,161,152)">"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie8 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">filter</span>:<span class="value"><span class="function">alpha(opacity=<span class="number" style="color:rgb(42,161,152)">50</span>)</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie5-7 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-moz-opacity</span>:<span class="value"><span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ old mozilla browser like scape /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-khtml-opacity</span>:<span class="value"> <span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ for really really old safari /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">opacity</span>:<span class="value"> <span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ css standard, currently it works in most modern browsers like firefox, /</span>
<span class="rule">}</span></span>
现在的兼容
复制代码
代码如下:<span class="class">.transparent_class</span> <span class="rules">{
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">-ms-filter</span>:<span class="value"><span class="string" style="color:rgb(42,161,152)">"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie8 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">filter</span>:<span class="value"><span class="function">alpha(opacity=<span class="number" style="color:rgb(42,161,152)">50</span>)</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ ie5-7 /</span>
<span class="rule"><span class="attribute" style="color:rgb(181,137,0)">opacity</span>:<span class="value"> <span class="number" style="color:rgb(42,161,152)">0.5</span>;</span></span> <span class="ment" style="margin-bottom:0px!important; display:inline!important; vertical-align:; color:rgb(88,110,117); font-style:italic">/ css standard, currently it works in most modern browsers /</span>
<span class="rule">}</span></span>
复制代码
代码如下:<!DOCTYPE html>
<html>
<head>
<style>
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 /
}
</style>
</head>
<body>
<h1>图像透明度</h1>
<img src="/i/tulip_peach_blossom_w_s.jpg" alt="Peach Blossom" />
<p><b>注释</b>在 IE 中,必须添加 <!DOCTYPE>,这样才能将 :hover 选择器用于除了 <a> 之外的其它元素。</p>
</body>
</html>
上一篇:hasLayOut与css属性的关系介绍
下一篇:CSS画出各种三角形如等边三角形
长沙网站设计
- 如何自己建一个网站 自己想建个网站,怎么建
- 如何制作网站免费建站 创建网站免费注册
- html简单网页代码 html简单网页代码超链接
- dreamweaver网页制作 dreamweaver网页制作模板
- 上海网站建设 上海网站建设制作微信
- 如何制作网站和网页 如何制作一个网页
- html网页制作代码大全 端午节html网页制作代码大
- app开发公司 app开发公司前十名
- html网页制作 html网页制作文字居中
- app制作一个需要多少钱 请人制作一个app多少钱
- 成都网站制作 成都网站制作维护
- 百度建一个网站多少钱 百度做个公司网站要多少
- html+css网页制作成品 web网页制作成品css+javascrip
- html网页制作案例 html网页设计案例
- html+css网页制作成品 web网页制作成品css+javascrip
- 个人网站模板 个人网站模板HTML