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>
|