z-index 속성(property) 예제

교교 2014.01.02 15:40:15
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#img1
{ position:absolute; left:0px; top:0px; z-index:-1 }
</style>
<script>
function changeStackOrder()
{
document.getElementById("img1").style.zIndex="1";
}
</script>
</head>
<body>
<h1>그림위에 글씨가 겹쳐 있음</h1>
<img id="img1" src="images/goose.jpg" width="200" height="180">
<input type="button" onclick="changeStackOrder()" value="스택 순서를 변경">
<p>Default z-index is 0. Z-index -1 has lower priority.</p>
</body>
</html>


aaa.PNG