×

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

CSS Border

CSS Border: The border property of CSS allows us to define the style, color, width, and radius of the element’s border. It is applied to various elements to set-up the...

4 minutes read.

CSS Color

CSS Colors: The CSS color property is used for setting the HTML element’s color. The color of the fonts and the color of the background can be set-up by using...

5 minutes read.

CSS Text-stroke

Text-stroke Text-stroke CSS property inserts the stroke to any text and gives a decoration option to them also. It describes the stroke’s width and color for various text characters. It is...

2 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 Text Orientation

Introduction: The text-orientation property of CSS is used to specify the orientation of the text characters in the line of content. This property applies only with the vertical writing-mode and not...

4 minutes read.

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

2 minutes read.

CSS Color Keywords

Here, we will discuss the following keywords: transparent currentcolor Inherit Transparent keyword A color can generally be made transparent by using the transparent keyword. Often it is used to for all intents...

4 minutes read.

CSS Background-blend-mode

Background-blend-mode The background-blend-mode property sets a blend mode of the component’s every background layer (color/image). It illustrates how the element background image blends well with the element background color. We can...

9 minutes read.

CSS White Space Property

White Space in CSS The white-space CSS property describes how to show the content inside an element. This property is applied to manage a white space within an element. Values of White-space...

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

CSS Flex-Box

Introduction The flex-box property of CSS stands for Flexible Box Layout Module. It is specifically used to design a flexible responsive layout. Flex-box is a one dimensional layout model, i.e. it works...

6 minutes read.

CSS Loader

CSS Loader The loader is the animation that can alert a visitor regarding the loading of the page. We need to wait for some time. It will be helpful if any...

4 minutes read.

CSS Word Wrap

Word Wrap in CSS: The word-wrap property in CSS is referred to break any lengthy word and wrap towards the next or following line. It is employed for preventing overflow...

1 minute read.

CSS Inline

What is CSS? CSS is an acronym for Cascading Style Sheets. CSS is the language that we use to style an HTML document. It specifies how HTML components should appear. CSS...

4 minutes read.

CSS Gradient

CSS Gradient: The CSS gradient property is applied to show the smooth transition inside two specified colors or more than two specified colors. Need of CSS Gradient The following are a few...

4 minutes read.

How to edit CSS in WordPress

Developing a new website or blog is a difficult undertaking. We want to create something that the consumers will adore, but we might not want the setting to take months and...

7 minutes read.

CSS 3D Transform

Introduction To understand 3D transformation property of transform you need to first understand the difference between 2D and 3D transform. 2D transform is a CSS effect which transforms the elements according to...

6 minutes read.

How to Set Space between the Flexbox

For managing layout on the Web, CSS Flexbox and CSS Grid are two excellent tools. Flexbox handles one-dimensional layouts quite well, whereas CSS Grid manages two-dimensional layouts with columns and...

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