HTML hyperlink a Mark CSS style example

Source: Internet
Author: User

Define four pseudo classes of link styles

1: link
    
2: visited
    
3: hover
    
4: active

Because we need to define the link style, it is essential to write the anchor tag -- a, anchor tag and pseudo-class link in the hyperlink, which is the basic method for defining the link style, they are written as follows:


1 a: link. Define the style of a normal link;
    
2 a: visited, which defines the style of the Accessed link;
    
3 a: hover, which defines the style when the mouse is suspended on the link;
    
4 a: active, define the style when the mouse clicks the link

Defining the sequence of link A in style sheet CSS may be helpful to you:


A: link {color: #000000; TEXT-DECORATION: none}
A: visited {COLOR: #000000; TEXT-DECORATION: none}
A: hover {COLOR: # ff7f24; text-decoration: underline ;}
A: active {COLOR: # ff7f24; text-decoration: underline ;}


The elements a: link, a: hover, and a: visited have different sequence when defining CSS, which directly leads to different display effects of links.
I think the reason is that the browser follows the "proximity principle" when interpreting CSS ".

Example

The code is as follows: Copy code


<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Style type = "text/css">
<! --
A. mytest: link {
FONT-SIZE: 12px; COLOR: # 5b5b5b; TEXT-DECORATION: none
}
A. mytest: visited {
FONT-SIZE: 12px; COLOR: #969696; TEXT-DECORATION: none
}
A. mytest: active {
FONT-SIZE: 12px; COLOR: # 0099ff; TEXT-DECORATION: none
}
A. mytest: hover {
FONT-SIZE: 12px; COLOR: # ff6102; TEXT-DECORATION: none
}
--> </Style>
<Title> Insert title here </title>
</Head>
<Body>
<A href = "#" class = "mytest"> test </A>
</Body>
</Html>

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.