设置超链接的样式示例:
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视频教程
以上就是html中如何设置超链接的样式的详细内容。