2016-10-05 48 views
-2

我希望div在父div中與文本一起均等設置。同時在父div中設置div以及文本

只顯示在圖像中。

here is the image

#container { 
 
    text-align: justify; 
 
} 
 
#container > div { 
 
    width: 90px; /* Declare your value. Can be in relative units. */ 
 
    display: inline-block; 
 
    vertical-align: top; 
 
    background: #f2f1f1; 
 

 
    /* IE fix. */ 
 
    *display: inline; 
 
    zoom: 1; 
 
    height: 90px; 
 
} 
 
#container:after { 
 
    content: ""; 
 
    width: 100%; 
 
    display: inline-block; 
 
}
<div id="container"> 
 
            <div></div> 
 
            <div></div> 
 
            <div></div> 
 

 
           </div>

謝謝。

回答

0

是否這樣?

#container { 
 
    display: flex; 
 
    justify-content: space-between; 
 
    width: 400px; 
 
    margin: 0 auto; 
 
} 
 
#container .box-container { 
 
    width: 90px; /* Declare your value. Can be in relative units. */ 
 
    display: flex; 
 
    flex-direction: column; 
 
    align-items: center; 
 
} 
 

 
#container .box-container .img { 
 
    width: 90px; 
 
    height: 90px; 
 
    background: #e7e7e7; 
 
}
<div id="container"> 
 
    <div class="box-container"> 
 
    <div class="img"></div> 
 
    <p>text</p> 
 
    </div> 
 
    <div class="box-container"> 
 
    <div class="img"></div> 
 
    <p>text</p> 
 
    </div> 
 
    <div class="box-container"> 
 
    <div class="img"></div> 
 
    <p>text</p> 
 
    </div> 
 

 
</div>

+0

啊..謝謝.. :) –