0

I want to create a simple image hover with AboutUsLink.png and AboutUsColourLink.png but I don't know how.

HTML:

<section class="link1">
    <a href="#SecondLink"><img src="images/LogoAndLinks/AboutUsLink.png"></a>
</section>

CSS:

.link1 {
    height: 100px;
    width: 100px;
    margin: auto;
    bottom: 0;
    left: 0;
    top: 0;
    right: 0;
    margin-top: 35%;
    margin-left: 22%;
    position: absolute;
    z-index: 1;
}
Spooky
  • 2,966
  • 8
  • 27
  • 41
Bartek Grzesiak
  • 1
  • 1
  • 1
  • 1

2 Answers2

1

For a CSS solution to this, set up your element like so:

<a href="#SecondLink"><div id="SecondLink"></div></a>

and then use the CSS to set the div background

#SecondLink {
    background-image: url('images/LogoAndLinks/AboutUsLink.png');
}

#SecondLink:hover {
    background-image: url('images/LogoAndLinks/AboutUsColourLink.png');
}

Take a look at this fiddle

zoranc
  • 2,410
  • 1
  • 21
  • 34
0
<section class="link1">
  <a href="#SecondLink">
     <img src="images/LogoAndLinks/AboutUsLink.png" 
          onmouseover="this.src='images/LogoAndLinks/AboutUsColourLink.png';" 
          onmouseout="this.src='images/LogoAndLinks/AboutUsLink.png';" />
  </a>
</section>
Mikhail Timofeev
  • 2,169
  • 15
  • 13