CSS控制图片、表格、背景颜色渐变示例

网站建设 2023-01-28 20:49www.1681989.com免费网站
CSS Filter 是 IE 特有的技术,其他浏览器均不支持,所以为了最大的兼容性及标准化,应尽量避免为 IE 单独使用 Filter,如需要其某些特效,应考虑其他浏览器,
图片渐变

复制代码
代码如下:

<img src="..." width=400 height=300 style="FILTER: Alpha( style=1,opacity=25,fishOpacity=100,startX=50,fishX=100,startY=50,fishY=100)">

表格渐变

复制代码
代码如下:

<table style="FILTER: Alpha( style=1,opacity=25,fishOpacity=100,startX=0,fishX=100,startY=0,fishY=100); BACKGROUND-COLOR: #ff0000">
<tr><td>12345678901234567890</td></tr></table>

背景渐变

复制代码
代码如下:

.bgjb{
background:-webkit-gradient(lear,left,right,from(#BDD4FD) ,to(#FFFFFF));
background:-moz-lear-gradient(left,#BDD4FD,#FFFFFF,);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#BDD4FD, endColorstr=#FFFFFF,GradientType=1 );
}/考虑其他浏览器,
<div class="bgjb"></div>
<body style="FILTER: Alpha( style=1,opacity=25,fishOpacity=100,startX=50,fishX=100,startY=50,fishY=100); BACKGROUND-COLOR: skyblue">
<body leftmarg="0" marg="0" margwidth="0" margheight="0" style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#46B5FF,endColorStr=#ffffff)" >
<body leftmarg="0" marg="0" margwidth="0" margheight="0"
style="FILTER: progid:DXImageTransform.Microsoft.Gradient
(gradientType=0,startColorStr=#46B5FF,endColorStr=#ffffff)" >
<div style="width:66;height:100%;float:left;FILTER:
progid:DXImageTransform.Microsoft.Gradient
(gradientType=1,startColorStr=#46B5FF,endColorStr=#ffffff)"></div>
<div style="width:66;height:100%;float:left;FILTER:
progid:DXImageTransform.Microsoft.Gradient
(gradientType=1,startColorStr=#ffffFF,endColorStr=#46B5FF)"></div>
<div style="width:66;height:100%;float:right;FILTER:
progid:DXImageTransform.Microsoft.Gradient
(gradientType=1,startColorStr=#ffffff,endColorStr=#46B5FF)"></div>
<div style="width:66;height:100%;float:right;FILTER:
progid:DXImageTransform.Microsoft.Gradient
(gradientType=1,startColorStr=#46B5FF,endColorStr=#ffffff)"></div>

若要使表格里面的元素不受影响
给里面的元素加上style="position:relative;"属性, 这样就不受影响了例如:

复制代码
代码如下:

[html]
<div style="width:200px;height:200px;filter: Alpha(opacity=10);background-color:red;">
<div style="position:relative;">123123</div>
</div>
[/html]

Copyright © 2016-2025 www.1681989.com 推火网 版权所有 Power by