WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

CSS Links


Styling Links

Links can be styled with any CSS property (for example color, font-family, background, etc.).

Example

a {
    shading: green;
}
Try it yourself »

The four connections states are:

  • a:link - characterizes the style for a typical, unvisited link
  • a:visited - characterizes the style for a connection the client has visited
  • a:hover - a connection when the client mouses over it
  • a:active - a connection the minute it is clicked

Example

/* unvisited connect */
a:link {
    shading: blue;
}

/* visited connect */
a:visited {
    shading: yellow;
}

/* mouse over connection */
a:hover {
    shading: green;
}

/* chose connection */
a:active {
    shading: hotblue;
}
Try it yourself »

When setting the style for a few connection states, there are some request rules:

  • a:hover MUST come after a:link and a:visited
  • a:active MUST come after a:hover

Text Decoration

The text-decoration property is generally used to expel underlines from links:

In the model beneath,

Example

a:link {
    content design: none;
}

a:visited {
    content beautification: none;
}

a:hover {
    content improvement: underline;
}

a:active {
    content adornment: underline;
}
Try it yourself »

Background Color

The background-color property can be utilized to determine a foundation shading for links:

Example

a:link {
    foundation shading: blue;
}

a:visited {
    foundation shading: hotgreen;
}

a:hover {
    foundation shading: hotpink;
}

a:active {
    foundation shading: hotyellow;
Try it yourself »

Advanced - Link Buttons

This precedent exhibits a further developed model where we join a few CSS properties to show interfaces as boxes/buttons:

Example

a:link, a:visited {
    foundation shading: yellow;
    shading: white;
    cushioning: 14px 25px;
    content adjust: focus;
    content improvement: none;
    show: inline-block;
}

a:hover, a:active {
    foundation shading: red;
}
Try it yourself »