html中如何设置超链接的样式

2020-07-18 11:30:18

设置超链接的样式示例:

a:link 超链接被点前状态

a:visited 超链接点击后状态

a:hover 悬停在超链接时

a:active 点击超链接时

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

(推荐教程:html教程)

代码区:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   <title>无标题文档</title>   <style type="text/css">  a:link   {       color:#000;       text-decoration:none;}   a:visited   {       color:#000;       text-decoration:none;}   a:hover   {       color:#F00;       text-decoration:underline;}   a:active   {       color:#F90;       text-decoration:underline;}   </style>   <link href="Untitled-1.css" rel="stylesheet" type="text/css" />  </head>  <body>   <a href="http://www.baidu.com/">百度一下</a>    </body></html>

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

相关视频教程推荐:html视频教程