Created
May 16, 2016 02:27
-
-
Save kjirou/175cde1fa699133a1a0d16e2d4c81bf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
background-color: #eee; | |
} | |
.content { | |
width: 300px; | |
height: 300px; | |
background-color: #ff0000; | |
text-align: right; | |
} | |
.content .pulldown { | |
position: absolute; | |
top: 180px; | |
left: 20px; | |
z-index: 2; | |
width: 100px; | |
height: 150px; | |
background-color: #ffff00; | |
} | |
.modal { | |
position: absolute; | |
top: 200px; | |
z-index: 1; | |
width: 400px; | |
height: 200px; | |
background-color: #0000ff; | |
text-align: right; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="content"> | |
content<br>z-index: auto; | |
<div class="pulldown">pulldown<br>z-index:2;</div> | |
</div> | |
<div class="modal">modal<br>z-index:1;</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
z-indexのデバッグをするときに、z-index属性を消すと、所属するスタッキングコンテキストが変わるので意図通りの検証ができないことがある。
例えば、
で、「c が a の上に出ないようにデバッグする」場合、
で、あれれ?となる。この場合は
が正しい検証方法。