


How to set the color of html a tag? Summary of color settings for hyperlinks (css style)
Everyone should be familiar with the
hyperlinka tag. This article mainly talks about the basic css style settings of the a tag. It introduces four color changes. I hope you can practice more. Below Let us read this article together
First we need to know the color setting of the html a tag:
We all know that in html the a tag is in the web page What does the default color look like? Now try the code to see:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> </head> <body> <a href="#">php中文网</a> </body> </html>
This is the code for a basic html document. Look at the display effect in the browser:
The unclicked URL above is blue like this, and after being clicked, it is purple. Such a link does not look good. We need to set a color for the a tag. For example, if I want to set a color for unclicked URLs, let's say red. Before being clicked, it is red, and after being clicked, it is black. Let’s do the effect:
<head> <meta charset="utf-8"> <title>PHP中文网</title> <style type="text/css"> a:link{color:red;} a:visited{color:black;} </style> </head> <body> <a href="#">php中文网</a> </body>
This is a simple css code, let’s take a look at the effect:
This is The style that has not been accessed is red;
This is the style that has been accessed and is black. Let’s explain the code:
a:link: It is an unvisited style. You can add many things to it, such as removing underlines, changing colors and other functions. ;
a:visited: It is the style after being clicked. You can also add many elements to it, and you can underline, change color, zoom in and other functions;
-
a:hover: This is the mouse hover style. There will be examples of this later. Let’s get to know it first. You can set the color to change when the mouse is parked at the position of the hyperlink;
a:active: This is said to be an activated style. To put it simply, it is a style that will appear instantly when you click the mouse. This style is found on many websites;
Now let’s take a look at an example, the effect of putting all the above four in:
<head> <meta charset="utf-8"> <title>PHP中文网</title> <style type="text/css"> a:link{color:red;} a:visited{color:black;} a:hover{color:pink;} a:active{color:#ccc;} </style> </head> <body> <a href="#">php中文网</a> </body>
Let’s take a look now at the browser The effect shown in:
This is the effect of mouse hovering, made
This is the click moment Effect. (Want to see more, please click css video tutorial)
Summary of hyperlink a tag:
So there are four types of a tag Now that we have introduced the CSS styles of anchor pseudo-classes, let’s recall the four uses. One is the unclicked style, which is the style that is displayed normally without being clicked. The style after being clicked is the style after you click the tag. , and another one is the mouse hover style, which changes when you put the mouse on it. This effect is very useful. You will know its use later. The last one is the effect at the moment of click. These four This effect can be said to be the four necessary styles for a tags, so the settings can be better.
【Editor’s Recommendation】
html5 What is the usage of datalist tag? Here are usage examples of the datalist tag
#What is the include tag in html? html include implements configuration parsing
The above is the detailed content of How to set the color of html a tag? Summary of color settings for hyperlinks (css style). For more information, please follow other related articles on the PHP Chinese website!

Here's a container with some child elements:

Flyout menus! The second you need to implement a menu that uses a hover event to display more menu items, you're in tricky territory. For one, they should

"The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."- Tim Berners-Lee

In this week's roundup: datepickers are giving keyboard users headaches, a new web component compiler that helps fight FOUC, we finally get our hands on styling list item markers, and four steps to getting webmentions on your site.

The short answer: flex-shrink and flex-basis are probably what you’re lookin’ for.

In this week's look around the world of web platform news, Google Search Console makes it easier to view crawled markup, we learn that custom properties

The IndieWeb is a thing! They've got a conference coming up and everything. The New Yorker is even writing about it:


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor