How to style hyperlinks in html

王林
Release: 2020-04-08 15:21:46
forward
7081 people have browsed it

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>
Copy after login

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!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!