Learn HTML step-by-step from A to Z or improve your professional skills.  Home HTML and CSS Tutorials Hover Links in CSS (part 1)

Hover Links in CSS (part 1)

Browse Pages: << < 1  2 

Hover Links in CSS (Part 2)Now that we know how to create hover links in CSS, lets learn how we can change more than just the color!

1. Here is what our document looks like so far:

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CSS Hover Links</title>
<style type="text/css" media="all">
a {
color: #007431;
}
a:hover {
color: #9A0319;
}
</style>
</head>
<body>
This is my Text.  <a href="http://www.greycobra.com">This is a Link to GreyCobra.com</a>.  Here is some more text.
</body>
</html>

2. As you can see, there are two states to our a tag.  The first one is simply a, and the latter is the a:hover.  We can specify how we want each to look inside of the { and }.  Currently, we are only changing the color style.  Lets insert the following code to make it so that our link is not underlined until it is hovered over:

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CSS Hover Links</title>
<style type="text/css" media="all">
a {
color: #007431;
text-decoration: none;
}
a:hover {
color: #9A0319;
text-decoration: underline;
}
</style>
</head>
<body>
This is my Text.  <a href="http://www.greycobra.com">This is a Link to GreyCobra.com</a>.  Here is some more text.
</body>
</html>

3. Save this and open it in an internet browser.  As you can see, it is not underlined until it is scrolled over.  We can also do the following:

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CSS Hover Links</title>
<style type="text/css" media="all">
a {
color: #007431;
text-decoration: none;
font-weight: bold;
font-family: arial;
font-size: 10px;
}
a:hover {
color: #9A0319;
text-decoration: overline underline;
}
</style>
</head>
<body>
This is my Text. <a href="http://www.greycobra.com">This is a Link to GreyCobra.com</a>. Here is some more text.
</body>
</html>

4. Save this and open it in an internet browser, and you will see that the styles are very customized now!  Continue to play around with these effects until you find desired results!

Result

Good Luck!



Author's URL: GreyCobra.com
Browse Pages: << < 1  2 
Learn HTML step-by-step from A to Z or improve your professional skills. More Tutorials: Featured Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

Reader's comments
comments home loans January 06, 2012 says:
If you want to buy a car, you would have to receive the loan. Moreover, my sister always takes a short term loan, which supposes to be the most reliable.
Reply
comments credit loans December 29, 2011 says:
If you are willing to buy a car, you will have to receive the mortgage loans. Moreover, my brother always uses a college loan, which seems to be the most fast.
Reply
comments home loans September 27, 2011 says:
I took 1 st home loans when I was a teenager and it helped me a lot. Nevertheless, I need the credit loan once again.
Reply
Add comments to "Hover Links in CSS (part 1)"

Captcha