Forum Moderators: not2easy
[edited by: SuzyUK at 9:38 pm (utc) on April 2, 2007]
[edit reason] Please no URI's per TOS #13 [WebmasterWorld.com] [/edit]
I'm sorry - newbie's first mistake. Did not understand that example page URLs were not allowed. Here's my second try
I've tried to come up with a page that contains (among other things)
1. an explanatory text
2. a larger image that shows when hovering over a thumbnail
3. a row of thumbnails
As I'm fairly new to the css world, my head can not figure out what I do wrong. I've tried in several ways, but the "larger image" will not stay in its place.
Is there anyone who can point out what I do wrong?
from the XHTML =====
<div id="inhoud">
<h1>Cum sociis</h1>
<p>Aliquam mollis tempus diam. Cum sociis natoque penatibus et magnis dis</p>
</div>
<div id="fotos">
<ul>
<li><a href="#"><img src="foto/herenhuish1k.jpg" alt=""/><span><img
src="foto/herenhuish1g.jpg" alt="" /></span></a></li>
<li><a href="#"><img src="foto/herenhuish3k.jpg" alt=""/><span><img
src="foto/herenhuish3g.jpg" alt="" /></span></a></li>
<li><a href="#"><img src="foto/herenhuish4k.jpg" alt=""/><span><img
src="foto/herenhuish4g.jpg" alt="" /></span></a></li>
</ul>
</div>
===============End
+++++++++++++++From css
#inhoud
{
margin: 230px 350px 0 9.5%;
max-width: 550px;
min-width: 300px;
}
a img {
border: none;
}
#fotos
{
position:relative;
margin: 330px 350px 0 9.5%;
max-width: 550px;
min-width: 300px;
}
/* start lijst opmaak horz */
#fotos ul {
margin: 0;
padding: 0;
list-style-type: none;
}
#fotos ul li {
display: inline;
}
#fotos ul li a {
text-decoration: none;
border: none;
padding-right: 2px;
}
/* end lijst opmaak horz */
img {
border: none;
}
span {
display: none;
}
span img {
border: none;
}
a:hover {
border: none;
text-decoration: none;
}
a:hover span {
display: block;
height: 300px;
visibility: visible;
z-index: 100;
}
a:hover span img {
position: relative;
top: -400px;
z-index: -1;
}
+++++++++++++++End css
Well, that looks like a lot of code, but I don't see how I could explain otherwise.
thnx again and greetings, nicolet
Anyway....
You have:
a:hover span {
display: block;
height: 300px;
position: absolute;
margin-top: -400px;
margin-left: 0;
}
And here's how it's working:
'position: absolute' means from the position of the element on the page, ok.
'margin-top: -400px' means the image is shifted 400 pixels upwards, ok.
'margin-left: 0' pointless. This means 0 pixels from the element on page, in this case the thumbnail, so basically means the same left as each thumbnail.
Try removing this and adding 'left: 9.5%' to match #fotos.
And Londrum, you are right. Stu Nichols has fine gallery's. It's just that this -almost- works and fits the rest of my lay-out. And, not unimportant, I understand what I'm doing!
:hover on all elements (instead of just the <a>nchor element) - it is quite a well known file - available for download @ whatever:hover [xs4all.nl] nicoletS - Welcome to WebmasterWorld btw..
a:hover span {
display: block;
height: 300px;
position: absolute;
margin-top: -400px;
margin-left: 0;
}
try using the actual co-ordinates instead of margins e.g.
a:hover span {
display: block;
height: 300px;
position: absolute;
top: -400px;
left: 0;
}
Suzy