2016-06-01 21 views
-4

HTML:要帶來DIV在DIV引導

<div class="col-lg-4">  
    <div class="outer-div"></div>  
    <div id="cropContainerMinimal1"></div>  
</div>  

CSS:

.outer-div { 
    padding-top: 75px;  
    padding-right: 72px;  
    padding-left: 69px;  
    padding-bottom: 92px;  
    background-image: url(../images/student-background.png);  
    background-repeat: no-repeat;  
    background-position: center center;  
    height:590px; 
} 

#cropContainerMinimal1 { 
    width:100%; 
    height:421px; 
    position: relative; 
    border:1px solid #ccc; 
} 

CSS是不是爲我工作。如果我玩absolute它會破壞所有的結構。如何解決這個問題?

+0

「如果我絕對玩」?如果你玩的相對一切都會好的。請更精確。如果您的問題描述太模糊,您如何期待我們的幫助? –

+0

我想把(outer div)帶到(cropContainerMinimal2)。我已經複製了兩個html結構。兩者都不適合我。外部div有背景PNG圖像。我想把它帶到(cropContainerMinimal2) –

回答

0

將您的outer-div移動到#cropContainerMinimal1之內並應用以下css。你可以玩toprightbottomleft屬性,使其根據您的需求。

.outer-div { 
 
    position: absolute; 
 
    background: rgba(0, 0, 0, 0.5); 
 
    bottom: 10px; 
 
    right: 10px; 
 
    left: 10px; 
 
    top: 10px; 
 
} 
 

 
#cropContainerMinimal1 { 
 
    background: #ccc; 
 
    width: 100%; 
 
    height: 421px; 
 
    position: relative; 
 
    border:1px solid #ccc; 
 
}
<div class="col-lg-4"> 
 
    <div id="cropContainerMinimal1"> 
 
    <div class="outer-div"></div> 
 
    </div> 
 
</div>

+0

謝謝,但它不適合我.. :( –