2017-04-26 7 views
0

コードエキスよりも高いのzインデックスを持つことは可能ですか?それは子が親

+0

はいhttps://jsfiddle.net/oab4z0du/ –

答えて

1

.parent { 
 
    width: 300px; 
 
    height: 300px; 
 
    background-color: #F4F4F4; 
 
} 
 

 
.child { 
 
    width: 200px; 
 
    height: 200px; 
 
    background-color: red; 
 
    border: 4px solid #000; 
 
    opacity: .9; 
 
    
 
    position: relative; 
 
    z-index: 2; 
 
} 
 

 
.other { 
 
    width: 150px; 
 
    height: 150px; 
 
    background-color: green; 
 
    border: 4px solid #000; 
 
    opacity: .9; 
 
    
 
    position: absolute; 
 
    top: 150px; 
 
    z-index: 1; 
 
}
<div class="parent"> 
 
    <div class="child"> 
 

 
    </div> 
 
</div> 
 

 
<div class="other"></div>

関連する問題