Home > Back-end >  How can I make this image href to index page
How can I make this image href to index page

Time:12-17

I'm trying to make this image a href, its like this because I couldn't figure out how to have the image align with the menu on the right. But now I'm trying to make the logo go to the front page, I have tried making the code <div > <div href="index.html" ></div> but that doesn't work. Any ideas how to fix this

div.picture1 {
   width:153px; 
   height:60px;
   background-image:url('Carlsberglogof.png'); 
<div >
            <div ></div>

enter image description here

CodePudding user response:

You can replace your div with an anchor tag. I added the green colour so you can see it.

a {
   display: block;
   width: 153px;
   height: 60px;
   background-image:url('Carlsberglogof.png'); 
   background-color: green;
}
<div >
  <a href="yourURL" ></a>
</div>

CodePudding user response:

You could use JavaScript, for example:

<div onClick="location.href='/index.html'"> ...

...or simply wrap the whole element in an <a> tag:

<div >
  <a href="index.html">
    <div ></div>
  </a>
</div>
  • Related