PDA

View Full Version : css questions - a:visited for an img within a class



seejigong
Dec 13th, 2008, 04:29 AM
I am a newb, so please forgive me if this seems to be an easy question....

I am trying to give a border only to my logo, which links to the home page.

How would I go abouts in giving it a border, assuming that it will be in a class by itself, to toggled when it is visited/hovered and etc...

Thanks.

abduraooft
Dec 13th, 2008, 04:55 AM
Could you show some relevant parts of your html?

PS: welcome to CF!

Excavator
Dec 13th, 2008, 05:27 AM
Hello seejigong,
Something like this might work for you:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
background: #CCC;
text-align:center;
font-family:Verdana, Geneva, sans-serif;
font-size:11px;
}
* {
margin: 0;
padding: 0;
border: none;
}
#wrap {
width: 760px;
background: #fff;
margin: 0 auto;
}
#header {
height: 140px;
background: #0C9;
}
.home_link a:link, .home_link a:visited, .home_link a:active {
float: left;
margin: 10px 0 0 10px;
text-decoration: none;
}
.home_link a:hover {
border: 5px solid #F00;
font-size: 0;
}
</style>
</head>
<body>
<div id="wrap">
<div id="header">
<span class="home_link"><a href="http://yoururl.com"><img src="link/to your/logo.gif" width="533" height="90" alt="logo" /></a></span>
<!--end header--></div>
<!--end wrap--></div>
</body>
</html>

be sure and change the width/height in red.

seejigong
Dec 13th, 2008, 10:22 AM
Thanks, that was exactly what I was looking for!