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

建站知识 2021-07-03 08:43www.168986.cn长沙网站建设
CSS Filter 是 IE 特有的技术,其他浏览器均不支持,所以为了最大的兼容性及标准化,应尽量避免为 IE 单独使用 Filter,如需要其某些特效,应考虑其他浏览器,
图片渐变

复制代码
代码如下:

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

表格渐变

复制代码
代码如下:

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

背景渐变

复制代码
代码如下:

.bgjb{
background:-webkit-gradient(linear,left,right,from(#BDD4FD) ,to(#FFFFFF));
background:-moz-linear-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,finishOpacity=100,startX=50,finishX=100,startY=50,finishY=100); BACKGROUND-COLOR: skyblue">
<body leftmargin="0" margin="0" marginwidth="0" marginheight="0" style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#46B5FF,endColorStr=#ffffff)" >
<body leftmargin="0" margin="0" marginwidth="0" marginheight="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.168986.cn 狼蚁网络 版权所有 Power by