How to set the color of HTML a tag? Summary of color settings for hyperlinks (CSS styles)

Source: Internet
Author: User
Hyperlink a tag everyone should be very familiar with this article is mainly about the basis of a tag CSS style settings, the introduction of the four kinds of color changes, I hope we have a lot of practice, let's read this article together

First we need to know the color setting of the HTML a tag:

We all know what the default color is in HTML for a tag in a Web page, and now try a code to look at it:

<!doctype html>

This is a basic HTML document code that looks at the display effect in the browser:

The above is not clicked on the URL is so blue, after the click is purple, such a link does not look very good, we want to set a color for a tag. For example, I'm going to set a color for a URL that's not clicked, it's red, it's red before it's clicked, and then it's black. Let's do a little bit of the effect:


Here is a simple CSS code to look at:

This is not visited, it is red;

This is the style that has been accessed and is black. Let's explain the code:

    • A:link: is not accessed the style, can add a lot of things in it, for example, remove the underline, change the color and other functions can be achieved here;

    • A:visited: Is the style that has been clicked, also can add many elements inside, can go underline, change color, enlarge and so on function;

    • A:hover: This is the mouse hover style, this has an example of the introduction, we first come to know, is to put the mouse in the location of the hyperlink can be set to change the color;

    • A:active: This is said to have been activated the style, simple to say is to put the mouse punctuation up, the instant out of style, on many sites have this style;

Now let's look at an example and put the above four in the effect:


Let's look at the effects shown in the browser:

This is the effect of mouse hover, made to

This is the effect of the instant click. (Want to see more, please click CSS Video tutorial)

Summary of Hyperlinks a tags:

So this a tag of the four kinds of anchor pseudo-class CSS style are all introduced, we come to recall the four kinds of use, one is not clicked on the style, is no click, normal display style, is clicked after the style is you click on this tag style, there is a mouse hover style, Is you a mouse put up will change the effect, the effect is very useful, we know after the use of the last one is the instant effect of click, these four kinds of effects can be said to be a label must have four kinds of style, so that the setting can be better.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.