Pergunta

I've come across a problem with images containing links. I have a fixed position PNG that acts as a header for my website. This image links back to my homepage. Scrolling under that are a series of thumbnails that you click on to see the full image. When you scroll down so a thumbnail is behind the header PNG, you can no longer click on the homepage link - it instead clicks in the link of the thumbnail behind.

I have a feeling it has something to do with the rollover function of the thumbnail - as it also makes the header PNG semi transparent, which isn't ideal. Here is my coding (first attempt at coding from scratch so apologies):

 <!DOCTYPE html>

<html>

<head>
<title>Daniel Lewsley</title>
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
</head>


<body>

<div id="header">
<a href="index.html"><img src="img/daniellewsley-header.png" alt="Daniel Lewsley"></a>
</div>

<!--
<div>
 <ul class="nav">
 <li class="nav"><a class="nav" href="illustration.html">Illustration</a></li>
 <li class="nav"><a class="nav" href="design.html">Design</a></li>
 <li class="nav"><a class="nav" href="other.html">Other</a></li>
 <li class="nav"><a class="nav" href="info.html">Info</a></li>
 </ul>
</div>
-->

<div id="gallerycontainer">
<div id="gallery"><a class="rollover" href="img/15.png"><img src="img/gallerythumb15.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/14.png"><img src="img/gallerythumb14.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/13.png"><img src="img/gallerythumb13.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/12.png"><img src="img/gallerythumb12.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/11.png"><img src="img/gallerythumb11.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/10.png"><img src="img/gallerythumb10.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/09.png"><img src="img/gallerythumb09.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/08.png"><img src="img/gallerythumb08.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/07.png"><img src="img/gallerythumb07.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/06.png"><img src="img/gallerythumb06.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/05.png"><img src="img/gallerythumb05.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/04.png"><img src="img/gallerythumb04.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/03.png"><img src="img/gallerythumb03.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/02.png"><img src="img/gallerythumb02.png" alt="Thumbnail"></a></div>
<div id="gallery"><a class="rollover" href="img/01.png"><img src="img/gallerythumb01.png" alt="Thumbnail"></a></div>
</div>

</body>

</html>

CSS:

body
{
background-color:white;
font-family:"Arial", arial, sans-serif;
font-size:0.875em; /*16px is 1em */
text-align:center;
margin:0 auto;
padding:0;
min-width:400px;
}

#header
{
font-size:0;
letter-spacing:0;
word-spacing:0;
background-color:white;
position:fixed;
/* margin:0 auto;
width:100%; */
}

ul.nav
{
list-style-type:none;
margin:5px;
padding:0;
overflow:hidden;
}
li.nav
{
display:inline-block;
}
a.nav
{
display:block;
width:100px;
background-color:#dddddd;
text-decoration:none
}

#gallerycontainer
{
padding:40px 0 0 0;
text-align:center;
font-size:0;
letter-spacing:0;
word-spacing:0;
}

#gallery
{
background-color:black;
width:400px;
height:300px;
display:inline-block;
}

a.rollover:hover
{
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
}

Any ideas as to what I'm doing wrong?

Foi útil?

Solução

You may set the z-index in CSS. If you set the z-index of the header image to -1, it will be sent to the background and you can click on your thumbnails.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top