?? css0304.htm
字號(hào):
<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>
<!--頂部結(jié)束-->
<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">當(dāng)前位置</font>:<a href="/default.htm" class="under">洪恩在線</a>
-> <a href="/pc/index.htm" class="under">電腦樂園</a> -> 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"> </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">分級(jí)屬性</a><br>
6.<a href="css0310.htm">鼠標(biāo)屬性</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="請(qǐng)您留言" border="0"><br> 談?wù)勀目捶?lt;/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 ("條發(fā)言")
</script>
</p>
<p class="p1" style="line-height:17pt" align="left"> </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> </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"> </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"> 網(wǎng)頁默認(rèn)的鏈接方式是這樣的:未訪問過的鏈接是藍(lán)色文字并帶藍(lán)色的下劃線,訪問過的超級(jí)鏈接是深紫色的文字并帶深紫色的下劃線。如果您所有的網(wǎng)頁都是這種樣式,是不是很單調(diào)呢?</p>
<p class="p2" style="line-height:17pt"> 其實(shí),利用文本屬性中的Text-decoration屬性就可以實(shí)現(xiàn)對(duì)超鏈接的修飾。我們先看下面的這段代碼:</p>
<p class="p2" style="line-height:17pt"> <font color="#006666"><html>
<br>
<title>link css</title> <br>
<head> <br>
<style> <br>
<!--</font><br>
<font color="#CC33CC">//*定義偽類元素(a:),大括號(hào)內(nèi)定義了前景色屬性和文本裝飾屬性,<br>
hover加上‘font-size’屬性目的是讓鼠標(biāo)激活鏈接時(shí)改變字體*//</font> <br>
<font color="#006666">a:link{color:green;text-decoration:none}</font><br>
<font color="#CC33CC">//*未訪問時(shí)的狀態(tài),顏色為綠色(green),文本裝飾屬性(text-decoration)值<br> 為沒有(none)*//</font>
<br>
<font color="#006666">a:visited{color:red;text-decoration:none}</font><br>
<font color="#CC33CC">//*訪問過的狀態(tài),顏色為紅色(red),文本裝飾屬性值為沒有*//</font> <br>
<font color="#006666">a:hover{color:blue;text-decoration:overline;font-size:20pt}</font><br>
<font color="CC33CC">//*鼠標(biāo)激活的狀態(tài),顏色為藍(lán)色(blue), 文本裝飾屬性值為上劃(overline),<br> 字體大小為20pt*//</font>
<br>
<font color="#006666">--> <br>
</style> <br>
</head> <br>
<body> <br>
<p style=“font-family:行書體;font-size:18pt”> <br>
<a href=“http://www.hongen.com”>未訪問的鏈接</a></p></font><br>
<font color="#cc33cc">//*加鏈接,顯示三種不同狀態(tài),并且定義了鏈接文本的字體和大小*//</font> <br>
<font color="#006666"><p> <a href=“http://www.hongen.com”>訪問過的鏈接</a></p>
<br>
<p> <a href=“http://www.hongen.com”>鼠標(biāo)激活的鏈接</a></p>
<br>
</body> <br>
</html> </font></p>
<p class="p2" style="line-height:17pt"> 您如果想看上述代碼的效果,請(qǐng)<em class="p3"><a href="sl/link.htm" target="_blank">點(diǎn)擊這里</a></em>。</p>
<p class="p2" style="line-height:17pt"> 我們從例子中看到?jīng)]有訪問過的鏈接以綠色顯示,并且去掉了下劃線;而訪問過的鏈接以紅色且沒有下劃線顯示;另外,當(dāng)鼠標(biāo)激活鏈接時(shí),鏈接以藍(lán)色顯示,并且加上了上劃線。這種效果是怎么實(shí)現(xiàn)的呢?它除了運(yùn)用了文本屬性中的text-decoration屬性,而且采用了偽類元素。<br>
通過上面的代碼注釋,相信您應(yīng)該對(duì)偽類元素有一個(gè)大概認(rèn)識(shí)。實(shí)際上我們用到的這種偽類應(yīng)當(dāng)稱之為“錨偽類”,它規(guī)定了鏈接不同狀態(tài)下的效果。 </p>
<p class="p2" style="line-height:17pt"> 怎么樣,是不是很簡(jiǎn)單的就可以實(shí)現(xiàn)動(dòng)態(tài)鏈接的效果,趕緊自己動(dòng)手試一試吧!下一節(jié)我將向您介紹“容器”屬性。
</p>
<hr color=blue size=1>
<p class="p1" align="right"><a href="css0303.htm">上一節(jié)</a> <a href="css0305.htm">下一節(jié)</a> </p>
<p> </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="請(qǐng)您留言" border="0"><br> 談?wù)勀目捶?lt;/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 ("條發(fā)言")
</script>
</p>
<p> </p></td><td width=15 background="/pc/img/line.gif"><p> </p></td>
</tr>
</table>
<!--底部開始-->
<script language="Javascript" src="/pub/js/foot.js"></script>
<!--底部結(jié)束-->
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -