CSS Link style settings

Source: Internet
Author: User

CSS link style, we know when we read an article, sometimes the mouse slide to some of the text, some text below will be under

Dash, or the color changes, we all know that this is a link, there is a decline in the line and color changes, are linked to the time

Our settings for the link style. The above we simply introduce what is the style, you may ask, wow, what is the style, how does not define

In fact, we do not have a better definition, we just need to understand. But I don't understand. No hurry. Please listen to my slow way:

Different links can have different styles, and link styles are available in CSS with arbitrary attributes, such as color color,font,background and so on. Wait, wait.

We often see some links when the mouse is not placed on the top of the time, no underline, when I accidentally slipped the mouse over the time, there is an underscore, this is how the matter, in fact, we learn the link should be the first to see the status of the link, the mouse slide to link and leave the link is a different state. , links have four states, respectively, link is not visited links, visited represents the visited link, hover means that the mouse is over, active is the mouse click link, we can set the different status of the link, to achieve the effect we want to link, For a lot of links style, a lot of tricks, we in this place simply introduce a style to look at:

Settings for color:

a:link{color:red;}
A:visited{color:blue;}
A:hover{color:black;}
A:active{color:green;}

We are here to set the style of the link, we have a consideration of the four states of the link. In this example, we are setting this link to the beginning of the color is red, after the visit is blue, when the mouse slide on the link above the time is black, when we click on the link when the link becomes green. That's what we do to a link style that varies with the state and also changes. In fact, we can think of the first two states as one is static, the latter two states as dynamic. Static state is the state we started, no action, dynamic is the user

The link generated the action. In the example above, we recognize these four states and recognize the basic patterns of the link style settings. There is also the setting for the color of the connected font.

Modification of text:

The modification of the text in this place is the same as the text decoration we encountered in the text format (see also: CSS text format). We introduced four states in the color setting, and we use this four for text retouching. When we read the article, we often slide the mouse to see where the underline, is what we do in the text decoration, the link text decoration is the text decoration of the linked font, the use of the properties are:

Text-decoration, such as this example:

A:link{text-decoration:none;}
/* is not underlined before access */
A:visited{text-decoration:none;}
/* After access is not underlined */
A:hover{text-decoration:underline;}
/* Slide the mouse over the text * *
A:active{text-decoration:underline;}
/* Underline when mouse clicks */

What we want to know in this place is a few values of text decorations, underline underscores, none without dashes, overline is an underscore, and we also need to know that links are underlined by default, So we want to let the user when the mouse slide to produce an effect can be in the static state to set its underline is none.

Background color:

The settings above are the settings for the font color of the link, and the decoration of the font. We can also set the background color for the link

The attribute used is the Background-color keyword, and the value of the property is the color value:

a:link{background-color:red;}
A:visited{background-color:blue;}
A:hover{background-color:orange;}
A:active{background-color:black;}

Setting the background color can help us to set up beautiful links, but until now, we are still out of this four-state framework, and now a bit annoying this immutable framework, how to do:

<style type= "Text/css" >
a.one:link{color:red;}
A.one:visited{color:blue;}
a.one:hover{color:red;}
/* In this place we see links that are set to color */
a.two:link{color:red;}
A.two:visited{color:blue;}
a.two:hover{font-size:150%;}
/* In the first two states we can be called the initial state, to the last state when it becomes our participation in the state of this time the font suddenly is bigger, we can understand as the mouse over the link of such a thing, action, not the state, if said the first two state value static, Then this place becomes dynamic.
a.three:link{color:red;}
A.three:visited{color:blue;}
A.three:hover{background-color:orange;}
/* In fact, when we design the link can also pay attention to a small
Skill, that is, we may be in the design of the time not need to design a click on the link when the state, because the user click on the moment will not pay attention to, that is, we focus on the former said that the focus of the introduction of the state, as well as we can see is in the first two states we are the color settings, Of course we have other properties that can also be designed for Bill to say the size of the font or the color of the background.
A.four:link{color:red;text-decoration:none;}
A.four:visited{color:black;text-decoration:none;}
A.four:hover{text-decoration:underline;}
/* In this place we can also see that we are in the text
Retouching when we are able to be in a state of
Property multiple settings can be set at the same time */
</style>

Now the settings for this link are a lot more free

     a:link,a:visited
     {
      Display:block;
      Font-weight:bold;
      color:red;
      background-color: #98bf21;
      width:120px;
      Text-align:center;
      padding:4px;
      Text-decoration:none;
    &NBSP;}
     a:hover,a:active
     {
      background-color: #7A991A;
    &NBSP;}
    </style>

<!--the link in the program will be more image of the expression, we will link in the form of a shape, in this place we may only have to analyze the property inside to see the benefits, that is, we set in the block properties including display
This expression is expressed in what style, as well as the thickness, or the color of the font, background color, that is, our block of color, as well as the text in the Block Buchbinderei alignment, and the distance between the text and the border, and finally the text is decorated that is underlined as none, we have to pay attention to this place It's our practice class.
In this place at the same time set up two states, including link and visited these two properties, of course, there is our two other states settings, is set is the background color, this is no wonder why we sometimes the mouse slide to what the other side found the color has changed--

CSS Link style settings

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.