⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 css0502.htm

📁 网页颜色渐变,可实现网页中背景色的渐变效果
💻 HTM
字号:
<html>
<head>
<title>洪恩在线 - CSS教程</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/pub/css/home.css">
<link rel="stylesheet" href="/pc/homepage/homepage.css">

<meta name="keywords" content="电脑乐园,电脑,乐园,交互教程,交互,教程,教育">
</head>
<body bgcolor="white" text="black" topmargin="10" leftmargin="0" marginwidth="0" marginheight="10">
<!--顶部开始--> 
<script language="Javascript" src="/pub/js/head.js"></script>
<!--顶部结束--> 
<table width="760" height="20" border=0 cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td height=20 class="p1" bgcolor="#E8E8E8" align="left"><img src="/pc/img/blank.gif" width="12" height="8"><font color="#FF9966">当前位置</font>:<a href="/default.htm" class="under">洪恩在线</a> 
      -&gt; <a href="/pc/index.htm" class="under">电脑乐园</a> -&gt; CSS教程</td>
  </tr>
</table>
<table width="760" border=0 cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td height="15"></td>
  </tr>
</table>
<table width="760" cellspacing="0" border=0 cellpadding="0" align="center">
  <tr> 
    <td width="145" valign="top" bgcolor="#E8E8E8" align="left" style="color:blue" class="p1" height="123"> 
     <br>
      <table width="145" border="0" cellspacing="0" cellpadding="0" bordercolor="#F8AC0E" height="20">
        <tr bgcolor="000099" valign="middle"> 
          <td width="115" align="center" class="p2"><b><font color="#FFFFFF">CSS教程</font></b></td>
          <td height="20" bgcolor="#E8E8E8" width="13"><img src="/pc/img/title_00.gif" width="13" height="20"></td>
          <td height="20" bgcolor="#E8E8E8" width="17">&nbsp;</td>
        </tr>
      </table>
      <p class="p1" style="line-height:17pt" align="left">  <font color="#CC3399">→</font> 
        <a href="css0101.htm">CSS快速入门</a><br>
         <font color="#CC3399">→</font> <a href="css0201.htm">怎样编写CSS</a><br>
         <font color="#CC3399">→</font> <a href="css0301.htm">CSS属性</a><br>
         <font color="#CC3399">→</font> <a href="css0401.htm">CSS定位</a><br>
         <font color="#CC3399">→</font> CSS滤镜<br>
           1.<a href="css0501.htm">概述</a><br>
           2.Alpha属性<br>
           3.<a href="css0503.htm">Blur属性</a><br>
           4.<a href="css0505.htm">Chroma属性</a><br>
           5.<a href="css0506.htm">Dropshadow属性</a><br>
           6.<a href="css0507.htm">Fliph、Fliv属性</a><br>
           7.<a href="css0508.htm">Gray属性</a><br>
           8.<a href="css0309.htm">Glow属性</a><br>
           9.<a href="css0510.htm">Invert属性</a><br><br>
      </p>
      <p align="center" class=p1><a href=/pc/bin/msg.pl?file_id=k_css target="_blank"><img src="/pc/img/message.gif" width="64" height="54" alt="请您留言" border="0"><br> 谈谈您的看法</a> 
        <br>
        <script language="javascript">
speak_num="za"
</script>
        <script language="javascript" src=/pc/var/pc_k_css.js>
</script>
        <script language="javascript">
var num=0
if (!isNaN(speak_num)){
	num=speak_num;
}
else{
	num=0
}
document.writeln ("已有")
document.writeln (num)
document.writeln ("条发言")
</script>
      </p>
      <p class="p1" style="line-height:17pt" align="left">&nbsp; </p>
      </td>
    <td width=1 bgcolor=#0586D7 height="123"><img src="/pc/img/blank.gif" width="1" height="1"> 
    </td><td width=15 background="/pc/img/line.gif"><p>&nbsp;</p></td>
    <td valign="top" background="/pc/img/line.gif" width="584" height="123" class="p2"> 
      <p align="center"><b><span class="p3"><br>
        <font color="#3366CC">五、CSS滤镜</font></span></b></p>
      <p align="right" class="p1">&nbsp;&nbsp;&nbsp;</p>
      <hr color=blue size=1>
      <p class="p2" style="line-height:17pt">  <font color="336633"><b>2、alpha属性</b> 
        </font></p>
      <p class="p2" style="line-height:17pt">  alpha是来设置透明度的。先来看一下它的表达格式:</p>
      <p class="p2" style="line-height:17pt">  <font color="006666">filter:alpha(opacity=opcity,finishopacity=finishopacity,<br>  style=style,startX=startX,startY=startY,finishX=finishX,<br>
          finishY=finishY)</font> </p>
      <p class="p2" style="line-height:17pt">  哇,怎么这么长。是啊,不过这些参数都各有其用。<br>
          Opacity代表透明度等级,可选值从0到100,0代表完全透明,100代表完全不透明。 Style参数指定了透明区域的形状特征。其中0代表统一形状;1代表线形;2代表放射状;3代表长方形。<br>
          Finishopacity是一个可选项,用来设置结束时的透明度,从而达到一种渐变效果,它的值也是从0到100。 StartX和StartY代表渐变透明效果的开始坐标,finishX和finishY代表渐变透明效果的结束坐标。 
        <br>
          从上面讲的我们可以看出,如果不设置透明渐变效果,那么只需设置opacity这一个参数就可以了。说了这么多,我们来看一个实例吧(见下图):</p>
      <p align="center"><img src="img/css024.jpg" width="280" height="183" border="0" alt="透明效果"></p>
      <p class="p2" style="line-height:17pt">  实现上面这种效果的代码如下:</p>
      <p class="p2" style="line-height:17pt">  <font color="006666">&lt;html&gt; 
        <br>
          &lt;head&gt;<br>
          &lt;title&gt;alpha&lt;/title&gt; <br>
          &lt;style&gt;</font><font color="CC33CC">//*定义CSS样式*//</font> <br>
          <font color="006666">&lt;!-- <br>
          div{position:absolute; left:50;top:70; width:150; }</font><br>
          <font color="CC33CC">//*定义DIV区域内的样式(位置为绝对定位,left、top、width的坐标)*//</font><br>
            <font color="006666">img{position:absolute;top:20;left:40;<br>
          filter:alpha(opacity=80)}</font> <br>
          <font color="CC33CC">//*定义图片的样式,绝对定位,滤镜属性是透明度为80*// </font><br>
          <font color="006666">--&gt; <br>
          &lt;/style&gt; <br>
          &lt;/head&gt; <br>
          &lt;body&gt; <br>
          &lt;div&gt; <br>
          &lt;p style=“font-size:48;font-weight:bold;color:red;”&gt;<br>
          Beautiful &lt;/p&gt;</font><font color="CC33CC">//*定义字体属性,前景色为红色*//</font> 
        <br>
          <font color="006666">&lt;/div&gt; <br>
          &lt;p&gt;&lt;img src=“ss01076.jpg”&gt; &lt;/p&gt;</font><br>
          <font color="CC33CC">//*导入一张图片*//</font> <br>
          <font color="006666">&lt;/body&gt; <br>
          &lt;/html&gt;</font></p>
      <p class="p2" style="line-height:17pt"><font color="006666"> </font> 如果在上面的代码中稍做改动,则将产生另外多种效果。我们只修改img的样式属性,把head中的Img样式属性代码改为如下所示:</p>
      <p class="p2" style="line-height:17pt">  <font color="006666">img{position:absolute;top:20;left:40;<br>
          filter:alpha(opacity=0,finishopacity=100,<br>
          style=1,startx=0,starty=85,finishx=150,finishy=85);}</font><br>
          <font color="CC33CC">//*设置透明渐变效果,起始坐标,终止渐变坐标,并设置透明样式值(style=1)为   线形*// 
        </font></p>
      <p class="p2" style="line-height:17pt">   这段代码产生的效果如左下图所示,右面的两幅图分别是把Alpha中的Style参数值为2和3后的效果,点击缩略图可放大。</p>
      <p align="center"><a href="img/css027.jpg" target="_blank"><img src="img/css0271.jpg" width="150" height="97" border="0" alt="style=1时的效果"></a> <a href="img/css026.jpg" target="_blank"><img src="img/css0261.jpg" width="150" height="98" border="0" alt="style=“2”时的效果"></a> <a href="img/css025.jpg" target="_blank"><img src="img/css0251.jpg" width="150" height="99" border="0" alt="style=3时的效果"></a></p>
      <p class="p2" style="line-height:17pt">      <font color="#6666FF">Style=1</font>        <font color="6666FF">Style=2 </font>      <font color="#CC3399"> <font color="6666FF">Style=3</font></font></p>
      <p class="p2" style="line-height:17pt"><font color="#CC3399">  </font>以上是CSS的Alpha滤镜属性的应用,具体应用还需要您自己找个例子练一练。<br>
          下一节我们将介绍blur(模糊)属性。</p>
      <hr color=blue size=1>
      <p class="p1" align="right"><a href="css0501.htm">上一节</a> <a href="css0503.htm">下一节</a>&nbsp;&nbsp;&nbsp;</p>
      <p>&nbsp;</p>
      <p align="center" class=p2><a href=/pc/bin/msg.pl?file_id=k_css target="_blank"><img src="/pc/img/message.gif" width="64" height="54" alt="请您留言" border="0"><br> 谈谈您的看法</a> 
        <script language="javascript">
speak_num="za"
</script>
        <script language="javascript" src=/pc/var/pc_k_css.js>
</script>
        <script language="javascript">
var num=0
if (!isNaN(speak_num)){
	num=speak_num;
}
else{
	num=0
}
document.writeln ("已有")
document.writeln (num)
document.writeln ("条发言")
</script>
      </p>
    <p>&nbsp;</p></td><td width=15 background="/pc/img/line.gif"><p>&nbsp;</p></td>
  </tr>
</table>
<!--底部开始--> 
<script language="Javascript" src="/pub/js/foot.js"></script>
<!--底部结束-->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -