tomfmason
09-21-2007, 02:37 PM
I have been fighting with this for a while now and i am really starting to get annoyed. I am attempting to write a simple css image gallery where when you mouse over an image a larger version is shown over the top of the first one. Here is what I have.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
.template{
display:block;
margin-top:50px;
margin-left:50px;
}
.template a, .template a:hover{display:block;}
.template ul{
list-style:none;
margin:0;
padding:0;
}
.template li{
float:left;
position:relative;
list-style:none;
padding:0;
margin:0;
padding-right:10px;
}
.template li a{
border:0;
display:block;
text-decoration:none;
}
.template li a img{
border:5px solid #6C757A;
}
.template li a:hover .large{
border:5px solid #5DA29A;
display:block;
}
.template li a:hover .large{
display:block;
position:absolute;
top:-20px;
left:-20px;
height:190px;
width:190px;
}
.template a .large{
display:none;
}
</style>
<title>Test</title>
</head>
<body>
<div class="template">
<ul>
<li>
<a href="#" title="template 1">
<img src="images/templates/template1.jpg" />
<img class="large" src="images/templates/template1.jpg" />
</a>
</li>
<li>
<a href="#" title="template 1">
<img src="images/templates/template2.jpg" />
<img class="large" src="images/templates/template2.jpg" />
</a>
</li>
</ul>
</div>
</body>
</html>
Here is a live version. http://tomfmason.net/dev/css_gallery.html . As I said in the title, it works perfectly in FF and Opera but fails in IE. I have fought with this for a while and am really close to just using some IE specific javascript for the same effect but I really don't want to use javascript if I don't have to..
I was looking at the demo in the IE developer tool bar and noticed that the li,a and imgs have has_layout:-1.. I am not really sure if that would be what is causing it to break in IE..
Any suggestions are more then welcome.
Thanks
Edit
After speaking with a friend I was told that it does in fact work in IE7 but not IE6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
.template{
display:block;
margin-top:50px;
margin-left:50px;
}
.template a, .template a:hover{display:block;}
.template ul{
list-style:none;
margin:0;
padding:0;
}
.template li{
float:left;
position:relative;
list-style:none;
padding:0;
margin:0;
padding-right:10px;
}
.template li a{
border:0;
display:block;
text-decoration:none;
}
.template li a img{
border:5px solid #6C757A;
}
.template li a:hover .large{
border:5px solid #5DA29A;
display:block;
}
.template li a:hover .large{
display:block;
position:absolute;
top:-20px;
left:-20px;
height:190px;
width:190px;
}
.template a .large{
display:none;
}
</style>
<title>Test</title>
</head>
<body>
<div class="template">
<ul>
<li>
<a href="#" title="template 1">
<img src="images/templates/template1.jpg" />
<img class="large" src="images/templates/template1.jpg" />
</a>
</li>
<li>
<a href="#" title="template 1">
<img src="images/templates/template2.jpg" />
<img class="large" src="images/templates/template2.jpg" />
</a>
</li>
</ul>
</div>
</body>
</html>
Here is a live version. http://tomfmason.net/dev/css_gallery.html . As I said in the title, it works perfectly in FF and Opera but fails in IE. I have fought with this for a while and am really close to just using some IE specific javascript for the same effect but I really don't want to use javascript if I don't have to..
I was looking at the demo in the IE developer tool bar and noticed that the li,a and imgs have has_layout:-1.. I am not really sure if that would be what is causing it to break in IE..
Any suggestions are more then welcome.
Thanks
Edit
After speaking with a friend I was told that it does in fact work in IE7 but not IE6