在父div中将div与文本一起设置

时间:2016-10-05 11:49:23

标签: html css

我希望在父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>
&#13;
&#13;
&#13;

谢谢。

1 个答案:

答案 0 :(得分:0)

喜欢这个吗?

&#13;
&#13;
#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;
}
&#13;
<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>
&#13;
&#13;
&#13;