2015-10-14 61 views

回答

0

更改您的代碼到這一點:

#container { 
    width: 100%; 
    height: auto; 
    position: relative; 
} 

#superDiv { 
    width: 100%; 
    height: auto; 
    z-index:10; 
    position: relative; 
} 

#childDiv{ 
    position: absolute; 
    bottom: 20px; 
    right: 0; 
    z-index: 30; 
} 
0
#childDiv { 
    z-index: 30; 
    position: absolute; 
    bottom: 0; 
    right: 0; 
} 
0

我已經編輯您的Plunk地做你想要它。我從

#superDiv { 
    width: 100%; 
    height: 100%; 
    position:relative; /* Note the change in position absolute -> relative */ 
    top: 0; 
    left: 0; 
} 

在此之後,我已經把刪除的#childDiv#childDiv到:

#childDiv{ 
    z-index: 30; 
    float:right; 
    position:absolute; 
    right:0; 
    bottom:0; 
} 

它在你#superDiv的右下角將其定位。

1

position: bottom不存在。而且你不需要float:right,因爲你正在使用絕對位置。

#container { 
    width: 100%; 
    height: auto; 
    position: relative; 
} 
#superDiv { 
    width: 100%; 
    height: auto; 
} 
#childDiv { 
    position: absolute; 
    bottom: 10px; /* 5px margin-top + 5px margin-bottom */ 
    right: 0; 
} 

希望有所幫助。

相關問題