Forum Moderators: not2easy

Message Too Old, No Replies

linking header to home page via CSS HELP!?!

cant get the header linked to homepage

         

GeddyLeeRocks

3:01 pm on Sep 13, 2007 (gmt 0)

10+ Year Member



Hello
I have been trying every combination oh a hovers hrefs around the div to get the header in this website Im doing. I can't figure it out.
CSS for header:

body#default #header {
width: 810px;
background: url(../images/bg.banner.jpg) no-repeat scroll left top;
margin: 0px auto;
height: 79px;
}

and in the page:

<div id="header">
</div>

back when I was just inserting an image into a cell I would link the image or use an image map - how the heck am I going to get this header to be clickable?

any suggestions?
Thanks
R

Marshall

9:15 am on Sep 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The only way to make the image clickable is put it in the header, not as a background image. There probably is some javascript option that could make the whole <div> a link and using an onclick event, but I am not sure.

An idea that just came to mind, though i do not know that this is "proper" is the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Header</title>
<style type="text/css">
#header {
height: 79px;
width: 100%;
padding 0;
}
#header a { /* Needed or the cursor won't change */
cursor: pointer;
cursor: hand; /* For older browsers */
}
#header_link {
height: 79px;
width: 100%;
margin: 0;
padding: 0;
background-color: transparent;
}
</style>
</head>

<body>
<div id="header">
<a href="http://www.yourdomain.com"><div id="header_link"></div></a>
</div>
</body>

</html>

It works in IE7.

Marshall