HTML基础(四)——设置超链接的样式示例

 ***设置超链接的样式示例 

a:link 超链接被点前状态

a:visited 超链接点击后状态

a:hover 悬停在超链接时

a:active 点击超链接时

在定义这些状态时,有一个顺序l v h a

代码区:

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 <style type="text/css">
 7 a:link
 8 {
 9     color:#000;
10     text-decoration:none;}
11 a:visited
12 {
13     color:#000;
14     text-decoration:none;}
15 a:hover
16 {
17     color:#F00;
18     text-decoration:underline;}
19 a:active
20 {
21     color:#F90;
22     text-decoration:underline;}
23 </style>
24 <link href="Untitled-1.css" rel="stylesheet" type="text/css" />
25 </head>
26 
27 <body>
28 <a href="http://www.baidu.com/">百度一下</a>
29 </body>
30 </html>
View Code

运行显示:鼠标箭头未放到“百度一下”,其显示黑色——放上时,其显示红色——点击“百度一下”链接时,其显示橙色——点击后,其显示黑色

原文地址:https://www.cnblogs.com/H2921306656/p/5658752.html