Web Design & Development

[ Web Design & Development Topics ]

Links and CSS

So now that you know how to make a link, you want to make it look cooler. In steps CSS. Here are some extremely simple samples below.

Making a link a color

So, lets say you just want to give the link a color. It would be this color no matter what. For example:

<a href="http://www.google.com" target="_blank" style="color:red">The Google Site</a>

gives you:

The Google Site

Making a link have a different look on hover

So, you want the link to do something when a person mouses over it. Now the CSS just became a tad harder.

First, go to the "head" area of your document (you can see it in source code above the "body" area) and put something like this in:

<style type="text/css">
.linkdemo {color: #776655; text-decoration: underline;}
.linkdemo:hover {color: #00703c; text-decoration: none;}
</style>

Great! now we need to use it. Go to your body area of your page and put something like this:

<a href="http://www.google.com" target="_blank" class="linkdemo">The Google Site</a>

And you should end up with:

The Google Site

Learn more: