tags:

views:

92

answers:

4

I am trying to set hyperlink to logo which is at the left side of the banner. when i use

<a href="home.php"> <div class="logo"></div></a>

its not working. help me to come out of this problem

+4  A: 

For these sorts of things I do something like this:

<div class="logo"><a href="home.php" id="logolink"></a></div>

In my CSS:

a#logolink { display: block; width: 500px; height: 100px; }

Adjusting heights and widths to fit your needs.

Dominic Rodger
+1  A: 
<a href="home.php"><img src='logo.png' /></a>
voyager
+3  A: 

You can't nest block elements like <div> in inline elements like <a>. You can put the <a> tag around the logo image, though:

<a href="home.php">
  <img src="logo.png" alt="Logo">
</a>
Joey
I'd upvote if the mandatory alt attribute wasn't missing.
David Dorward
Meh. That was supposed to be a code snippet not a ready-made solution :-)
Joey
+4  A: 

You can't do that since <a> is an inline element, while <div> is a block element. You should replace your <div> with an inline element such as <span>, or follow what Dominic Rodger said.

Boro