×

CSS Links

CSS Link is used to create styled link. There are various ways to implement it.

Styling Links

Link can be styled with CSS properties like color, font-family, background etc. Example:
<!DOCTYPE html>  
<html>  
<head>  
<style>  
a {  
    color: red;  
}  
</style>  
</head>  
<body>  
<p><b><a href="https://www.tutorialandexample.com"   
target="_blank">This is a link</a></b></p>  
</body>  
</html>
Try Now

There are four states of links

  • a:link : A normal, unvisited link.
  • a:visited : A link the user has visited.
  • a:hover : A link when the user mouse over it.
  • a:active : A link the moment it is clicked.
Example:
/* unvisited link */
a:link {  
    color: yellow;  
}  
/* visited link */  
a:visited {  
    color: red;  
}  
/* mouse over link */  
a:hover {  
    color: orange;  
}  
/* selected link */  
a:active {  
    color: blue;  
}
Note:
    • a:hover MUST come after a:link and a:visited.
    • a:active MUST come after a:hover.

Text Decoration

Text Decoration property is used to remove hte underlines from links:. Example
a:link {  
    text-decoration: none;  
}

Advanced Link Buttons

The example of advance link button uses several CSS properties to display the link as box/buttons: Example
<!DOCTYPE html>  
<html>  
   <head>  
      <style>  
         a:link, a:visited {  
         background-color:orange;  
         color: white;  
         padding: 14px 25px;  
         text-align: center;  
         text-decoration: none;  
         display: inline-block;  
         }  
         a:hover, a:active {  
         background-color: red;  
         }  
      </style>  
   </head>  
   <body>  
      <a href="https://www.tutorialandexample.com">This is a link</a>  
   </body>  
</html>
Try Now

Related Topics

CSS Introduction

CSS stands for Cascading Style Sheet. It is a design language which is used to design the web pages. It was developed by Håkon Wium Lie on October 10, 1994. It provides...

1 minute read.

How to change background color in CSS

How to change background color in CSS? The background-color property in CSS would be used to specify the color of an element's background. As the element's background, it uses solid colors. The...

3 minutes read.

CSS Position

CSS Position: The position property in CSS is applied to set the position of the elements. It can be used to position the backside of an element. It is also...

3 minutes read.

Hover condition for a:before and a:after in CSS

In CSS, :after and :before are used to add content after and before the element. The CSS pseudo-class is used to add some styling effect to the webpage. We can change...

4 minutes read.

How to change the font in CSS

How to change the font in CSS? Professionals can't deny typefaces — how users organize and style text — if we want to completely customize the website's design. One may wish...

4 minutes read.

CSS Reference

The CSS Reference lists all of the basic standard CSS properties, pseudo-classes, pseudo-elements, and data types, for all intents and purposes functional notations, and at-rules alphabetically.  The site also includes...

5 minutes read.

CSS calc()

CSS calc(): The CSS calc() function is a CSS function of inbuilt type, which permits us to implement calculations. It is used for calculating the angle, integer frequency, number, time,...

3 minutes read.

Radial-gradient() CSS function

Radial-gradient() CSS function It defines a CSS in-built function, which produces a smooth transition among multiple colors. It is used to set any radial-gradient that is same as a background-image. This...

4 minutes read.

CSS Form

You can create attractive HTML form by using CSS. Style input Fields The Input Field width properties are used to determine the width of the input field. Let us see an example of CSS style...

2 minutes read.

CSS Superscript and Subscript

Superscript and Subscript To specify the superscript and the subscript text, HTML provides us two tags that are <sup> and <sub>. The superscript content looks in the shorter font and half...

2 minutes read.

CSS Checkbox style

CSS Checkbox style: It is an element of HTML, which is used to get input from various users. It is difficult to style any checkbox. However, some elements make it...

6 minutes read.

CSS Zoom

CSS Zoom: Zoom property in CSS extents the content. This property controls the content’s level of magnification. Rather than the use of this CSS property, we may also apply the...

3 minutes read.

CSS Float

CSS Float: The float property of CSS is the positioning property. This property is applied to elements to push them either to left or right. It permits for wrapping facility...

4 minutes read.

Grid Vs Flexbox in CSS

Grid: - CSS Grid Layout is a 2D grid-based matrix-based layout method with columns and rows that simplifies web pages created by eliminating the need for floats and placement. A grid layout, like...

4 minutes read.

CSS Radio Button

Radio Button A radio button has been defined as an element of HTML. It can support us to take any input from the user. But it is challenging to design a...

4 minutes read.

CSS Font

CSS Font: CSS has font property, which makes the text more attractive. We can alter the entire look by changing font color, font size, font style, and much more. In...

5 minutes read.

CSS Padding

CSS Padding: The padding property in CSS is addressed to describe the space among the element border and the element content.This property is quite different from the margin property of...

2 minutes read.

How to resize an image in CSS

How to resize an image in CSS? The resize image attribute is used in responsive web design to resize images to fit within the div container automatically. The resize image attribute...

3 minutes read.

CSS Navigation bar

CSS Navigation bar: A navigation system or navigation bar comes upon GUI that can help many visitors to access the information. A Navigation bar is a UI component on the...

11 minutes read.

CSS Lists

CSS Lists: Several properties are available in CSS that are used to manage the lists. Lists are distributed as ordered and unordered kind of lists. The ordered lists provide the...

7 minutes read.