RWDHTMLCSS.COM

Html & CSS Walkthrough

Previous Home Table of Contents Next

Html & CSS for Links

To make a link on the HTML page:
<a href="http://linktopage.com">Click Here</a>
If the page you are linking to is on your website and is in the same folder, you do not need the http:// :
<a href="linktopage.com">Click Here</a>
To make a page open in a new window add target="_blank":
<a href="http://linktopage.com" target="_blank">Click Here</a>
To make a picture a link:
<a href="http://webpageurl.html" target="_blank"><img src="picture.jpg" alt="picture of train"></a>
target="_blank" will make the link open in a new window. You can remove the target="_blank"
<a href="http://webpageurl.html"><img src="picture.jpg" alt="picture of train"></a>
<a href="http://webpageurl.html"><img src="picture.jpg" alt="picture of train" style="width:100px;height:100px;"> </a>
<a href="http://webpageurl.html"><img src="picture.jpg" alt="picture of train" class="pic333"></a>

There are 4 link states. They must be in this order: Link, Visited, hover and active. .navbar a:link refers to all the a tags inside the navbar element. If you were going to style all the links on your page the same, you would write: a:link instead of .navbar a:link.
Link is the state of the link before it is clicked or hovered over.
Visited is after the page has been clicked and visited.
Hover is while the mouse is hovering over the link.
Active is while the mouse button is pressed down clicking the link.

.navbar a:link {
       color:white;
       text-decoration:none;
       font-weight:bold;
       outline: none;
       font-size-size:16px;
}
.navbar a:visited {
       color:white;
       text-decoration:none;
       font-weight:bold;
       outline: none;
       font-size-size:16px;
}
.navbar a:hover {
       color:lightblue;
       text-decoration:none;
       font-weight:bold;
       outline: none;
       background-color:black;
       font-size-size:16px;
}
.navbar a:active {
       color:red;
       text-decoration:none;
       font-weight:bold;
       outline: none;
       background-color:white;
       font-size-size:16px;
}

Previous Home Table of Contents Next