Home  >  Article  >  Web Front-end  >  How to style hyperlinks in html

How to style hyperlinks in html

王林
王林forward
2020-04-08 15:21:467119browse

How to style hyperlinks in html

Example of setting the hyperlink style:

a:link The state before the hyperlink is clicked

a:visited The state after the hyperlink is clicked

a:hover When hovering over a hyperlink

a:active When clicking a hyperlink

When defining these states, there is an order l v h a.

(Recommended tutorial: html tutorial)

Code area:

<!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>

Run display: The mouse arrow is not placed on "Baidu Click", and its display Black - when placed, it displays red - when the "Baidu Click" link is clicked, it displays orange - after clicked, it displays black.

Recommended related video tutorials: html video tutorial

The above is the detailed content of How to style hyperlinks in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete