2013-10-25 31 views

回答

0

是的,這是可能的

here is an example

HTML

<div class="one"> 1 </div> 

<div class="parent"> 
    parent 
    <br/> <br/> <br/> <br/> 
    <div class="child"> 
     child 
    </div> 
</div> 

CSS

.one{ 
    background:yellow; 
    height:30px; 
    width:100px; 
    position:absolute; 
    top:50px; 
} 

.parent{ 
     background:green; 
    height:300px; 
    width:100px; 
} 

.child{ 
    background:black; 
    height:100px; 
    width:60px; 
} 
+0

您的jsfiddle通往jsfiddle主頁。 – Albzi

+0

這不符合我的要求。如果你給這個div分配一個100px的頂部,那它就是這個孩子了。我希望它低於孩子但高於父母。 – ShivamD

0

好吧,關於什麼:

HTML

<div class="one">One 
</div> 

<div class="parent">Parent 
    <div class="child">Child 
    </div> 
</div> 

CSS

.one { 
    margin-top: 100px; 
    background: blue; 
    height: 200px; 
    width: 100px; 
} 

.parent { 
    background: yellow; 
    height: 100px; 
    width: 100px; 
    position: relative; 

} 
.child { 
    position: absolute; 
    background: green; 
    height: 100px; 
    width: 100px; 
    top: -300px; 
} 

檢查出來here

相關問題