2015-07-21 37 views
2

我想將.image正好落後於.description-wrap。我試過使用填充和邊距來居中,但沒有去。將div正好落後於另一個

.image img { 
display:block; 
margin: 0 auto; 
width:30%; 
bottom:100px 
} 

https://jsfiddle.net/vsdLk90s/

+0

你只是想通過另一個疊加一個元素? – DavidG

+0

@DavidG Yup。我只是想讓圖像完全位於文本的下方。我有這種需要發生的多個實例。 – user2252219

+0

因此,給'description-wrap'元素一個'position:absolute;' – DavidG

回答

2

我已經做了一些改動你的代碼,並在註釋中解釋它們。

.image { 
    position: absolute; /* Out of flow of current structure */ 
    width: 70%; /* To regain the width of previous layout */ 
    margin-top: -15%; /* Align it vertically */ 
    z-index: -1; /* Priority reordering, place the image underneath the text */ 
} 

JSfiddle