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
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
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.
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>
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.