This time I will continue to introduce some tips on style sheet applications. As you know, the definition of a style sheet is for containers (tags). In HTML, Anchor (Anchor, or hyperlink tag) is a type of container with a very large role. It implements the most fundamental functions of HTML (hypertext and hyperlink ). CSS also has some special usage of Anchor. Makes the page connection more compact and more organized.
Like other tags, the Anchor definition method can also be:
A: {css tag}
However, it has various related attributes, such as visited, active, hover, and link ). Specific definitions can be made based on different needs to respond to different user actions, so as to produce better results.
For example, you can define the following:
The code is as follows: |
Copy code |
<Html> <Head> <Title> Untitled Document </title> <Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"> <Style type = "text/css"> <! -- A: active {font-family: ""; font-size: 9pt; color: # 9999FF; text-decoration: underline} a: hover {font-family: ""; font-size: 9pt; color: #99FF99; text-decoration: underline} a: link {font-family: ""; font-size: 9pt; color: # FFCCCC; text-decoration: none} --> </Style> </Head> <Body bgcolor = "#000000" type = "codeph" text = "/codeph"> <A href = "www. www. www"> Return </a> </Body> </Html>
|
In this example, three states are defined: active, hover, and link. When there is a hyperlink in the example, it will show a pale red like Figure 1, and when you place the mouse over it, the mouse turns into a hand shape, the link will show the bright green figure 2. Once accessed, the link will show a deep red. This change not only looks beautiful, but also reminds users. It is used by most websites.
In fact, there are many times when we do not use the anchor, we also need to make some changes based on the user's actions. At this time, we often need to give users some tips when they control the mouse over the object. For example, change the mouse shape. Like a Hand, a cross, and so on, combined with the necessary javas pipeline, can there be a very dazzling effect? In addition, it is easy to change the current focus if you use an anchor. For example, when we use the layer concept in Dhtml, if the layer is invisible, use the anchor to change it to visible. Once the mouse moves up, the focus is immediately on the layer, this makes everyone feel very inconvenient. However, css has this attribute, which can help us change the mouse attribute and relieve this worry.