
Originally Posted by
mburt
Regarding the z-index, it's impossible to make the first one lap over the shadow. .shadow2 has position:absolute, which automatically makes it on top, no matter what the z-index is :confused:
Not impossible:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.shadow {
border:1px solid silver;
padding:2px;
font:10pt arial;
display:inline;
background-color:white;
position:relative;
top:20px;
z-index:1;
}
.shadow2 {
overflow:hidden;
background-color:black;
position:absolute;
filter:alpha(Opacity=20);
opacity:0.2;
-moz-opacity:0.2;
-khtml-opacity:0.2
}
</style>
<script type="text/javascript">
onload = function() {
for (var i = 0, a = document.getElementsByTagName("DIV");i < a.length;i++) {
if (a[i].className == "shadow") {
var newSd = document.createElement("DIV")
newSd.className = "shadow2"
newSd.style.width = a[i].offsetWidth+'px'
newSd.style.height = a[i].offsetHeight+'px'
newSd.style.left = a[i].offsetLeft + 4+'px'
newSd.style.top = a[i].offsetTop + 4+'px'
document.body.appendChild(newSd)
}
}
}
</script>
</head>
<body>
<div class="shadow">Test 1</div>
<br><br><div class="shadow">Test Number 2</div>
</body>
</html>
Bookmarks