Controlling hyperlink color display with CSS styles

Source: Internet
Author: User

Many people on the Web page to achieve different links have different colors do not know how to deal with, if you change the properties of a, as if all the color of the link changed.


Four hyperlinks in the state of the corresponding CSS properties: a{}, a:hover{}, a:visited{}, a:active{}, usually only write a{}, a:hover{}, if you need the other two font color settings, please refer to the order to write

a{color:red;}
A:visited{color:green;}
a:hover {color:yellow;background:blue;}
a:active {color:lime;background:red;}

Emit a different font color setting tip: When the text is selected with the font and background color (the default is blue white), this default effect can be changed by the following settings.

::-moz-selection {background: #d3d3d3; color: #555;}
::-webkit-selection {background: #d3d3d3; color: #555;}
:: Selection {background: #d3d3d3; color: #555;}

In fact, using CSS style to achieve this effect is relatively simple.

First look at the common settings:

A:link the Normal style of a hyperlink
A:visited clicked on
A:hover when the mouse passes through the
A:active when clicked
A:link{text-decoration:none;} No underline
A:link{text-decoration:underline;} With underline

To achieve different links, we want to define a CSS rule for that link for different effects.
Like what:

Our regular CSS is like this:
A:link{color: #ff0000}
So the color of all the links on the page is: #ff0000.
Now let's change:
A:link{color: #ff0000}
. line1 A:link{color: #000000}

Also, before you want to change the color of the link before adding CSS definition, like this: <span class=line1><a href= "/" > different colors of hyperlinks </a></span> The color of the link changes.

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.