스택 순서를 설정하려면 zIndex 를 사용하십시오. 재산. 다음 코드를 실행하여 zIndex를 구현할 수 있습니다. JavaScript의 속성 -
예시
<!DOCTYPE html>
<html>
<head>
<style>
#myID {
position: absolute;
left: 20px;
top: 20px;
z-index: -1
}
</style>
</head>
<body>
<img id = "myID"
src="https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg"
width = "150" height = "150">
<button type="button" onclick="myFunction()">Set Stack Order</button>
<p>Z-index is -1</p>
<script>
function myFunction() {
document.getElementById("myID").style.zIndex = "1";
}
</script>
</body>
</html>