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

📄 css0304.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> CSS属性<br>
           1.<a href="css0301.htm">字体属性</a><br>
           2.<a href="css0302.htm">颜色和背景属性</a><br>
           3.文本属性<br>
            ※<a href="css0303.htm">定义间距</a><br>
            ※装饰超链接 <br>
           4.<a href="css0305.htm">“容器”属性</a><br>
           5.<a href="css0309.htm">分级属性</a><br>
           6.<a href="css0310.htm">鼠标属性</a><br>
         <font color="#CC3399">→</font> <a href="css0401.htm">CSS定位</a><br>
         <font color="#CC3399">→</font> <a href="css0501.htm">CSS滤镜</a> <br>
         <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="#CC3399">※装饰超链接</font></p>
      <p class="p2" style="line-height:17pt">  网页默认的链接方式是这样的:未访问过的链接是蓝色文字并带蓝色的下划线,访问过的超级链接是深紫色的文字并带深紫色的下划线。如果您所有的网页都是这种样式,是不是很单调呢?</p>
      <p class="p2" style="line-height:17pt">  其实,利用文本属性中的Text-decoration属性就可以实现对超链接的修饰。我们先看下面的这段代码:</p>
      <p class="p2" style="line-height:17pt">   <font color="#006666">&lt;html&gt; 
        <br>
           &lt;title&gt;link css&lt;/title&gt; <br>
           &lt;head&gt; <br>
           &lt;style&gt; <br>
           &lt;!--</font><br>
           <font color="#CC33CC">//*定义伪类元素(a:),大括号内定义了前景色属性和文本装饰属性,<br>
           hover加上‘font-size’属性目的是让鼠标激活链接时改变字体*//</font> <br>
           <font color="#006666">a:link{color:green;text-decoration:none}</font><br>
           <font color="#CC33CC">//*未访问时的状态,颜色为绿色(green),文本装饰属性(text-decoration)值<br>   为没有(none)*//</font> 
        <br>
           <font color="#006666">a:visited{color:red;text-decoration:none}</font><br>
           <font color="#CC33CC">//*访问过的状态,颜色为红色(red),文本装饰属性值为没有*//</font> <br>
           <font color="#006666">a:hover{color:blue;text-decoration:overline;font-size:20pt}</font><br>
           <font color="CC33CC">//*鼠标激活的状态,颜色为蓝色(blue), 文本装饰属性值为上划(overline),<br>   字体大小为20pt*//</font> 
        <br>
           <font color="#006666">--&gt; <br>
           &lt;/style&gt; <br>
           &lt;/head&gt; <br>
           &lt;body&gt; <br>
           &lt;p style=“font-family:行书体;font-size:18pt”&gt; <br>
           &lt;a href=“http://www.hongen.com”&gt;未访问的链接&lt;/a&gt;&lt;/p&gt;</font><br>
           <font color="#cc33cc">//*加链接,显示三种不同状态,并且定义了链接文本的字体和大小*//</font> <br>
           <font color="#006666">&lt;p&gt; &lt;a href=“http://www.hongen.com”&gt;访问过的链接&lt;/a&gt;&lt;/p&gt; 
        <br>
           &lt;p&gt; &lt;a href=“http://www.hongen.com”&gt;鼠标激活的链接&lt;/a&gt;&lt;/p&gt; 
        <br>
           &lt;/body&gt; <br>
           &lt;/html&gt; </font></p>
      <p class="p2" style="line-height:17pt">  您如果想看上述代码的效果,请<em class="p3"><a href="sl/link.htm" target="_blank">点击这里</a></em>。</p>
      <p class="p2" style="line-height:17pt">   我们从例子中看到没有访问过的链接以绿色显示,并且去掉了下划线;而访问过的链接以红色且没有下划线显示;另外,当鼠标激活链接时,链接以蓝色显示,并且加上了上划线。这种效果是怎么实现的呢?它除了运用了文本属性中的text-decoration属性,而且采用了伪类元素。<br>
          通过上面的代码注释,相信您应该对伪类元素有一个大概认识。实际上我们用到的这种伪类应当称之为“锚伪类”,它规定了链接不同状态下的效果。 </p>
      <p class="p2" style="line-height:17pt">  怎么样,是不是很简单的就可以实现动态链接的效果,赶紧自己动手试一试吧!下一节我将向您介绍“容器”属性。 
      </p>
      <hr color=blue size=1>
      <p class="p1" align="right"><a href="css0303.htm">上一节</a> <a href="css0305.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 + -