CSS Links

CSS Tutorial


Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

CSS Advanced


Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2298

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2302

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2308

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2312

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2316

Notice: Trying to get property 'post_status' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2320

Notice: Trying to get property 'ID' of non-object in /home/u212091429/domains/mydevhelp.com/public_html/wp-admin/includes/template.php on line 2334

CSS Responsive

CSS Grid

CSS Links

Any CSS property can be used to add style to the link (e.g. color, font-family, background, etc.).

Links can be styled in any way depending on what state they are in.

The four links states are:

  • a:link – a normal, unvisited link.
  • a:visited – a link the user has visited.
  • a:hover – a link when the user mouses over it.
  • a:active – a link the moment it is clicked.
HTML
				
					<p><b><a href="#" target="_blank">This is a link</a></b></p>
				
			
CSS
				
					a:link {
  color: red;
  border:1px solid black;
}

/* visited link */
a:visited {
  color: green;
}

/* mouse over link */
a:hover {
  color: hotpink;
}

/* selected link */
a:active {
  color: blue;
}

				
			

Output

This is a link

To set the style for several link states, there are certain rules that must be followed:

  • a:hover should come after a:link and a:visited.
  • a:active should come after a:hover.

Text Decoration

The text-decoration property is used to remove the underlines from links:

CSS
				
					a:link {
  text-decoration: none;
}

a:visited {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:active {
  text-decoration: underline;
}

				
			

Output

This is a link

Background Color

The background-color property specifies a background color for links:

CSS
				
					a:link {
  background-color: yellow;
}

a:visited {
  background-color: cyan;
}

a:hover {
  background-color: lightgreen;
}

a:active {
  background-color: hotpink;
} 

				
			

Output

This is a link

Link Buttons

This example illustrates a more advanced example where several CSS properties are combined to display links as boxes/buttons:

CSS
				
					a:link, a:visited {
  background-color: #f44336;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

a:hover, a:active {
  background-color: red;
}

				
			

Output

This is a link


Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/u212091429/domains/mydevhelp.com/public_html/wp-includes/functions.php on line 5420

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/u212091429/domains/mydevhelp.com/public_html/wp-includes/functions.php on line 5420