控制理由内容中的空间量:

Cak*_*ers 5 html css css3 flexbox

我想知道如何证明justify-content: space-betweenflexbox 允许有多少空间。

目前,我的项目之间是有间隔的,但是它们之间的空间太大了,我希望它们之间只有一点空间,以便它们可以连续摆在中间。

下面的代码片段有望阐明我正在努力解决的问题。

让我知道您是否需要我进一步澄清。谢谢!

#qwrapper {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
}
.row {
  flex: 0 auto;
  height: 100px;
  margin: 0;
}
#lighticon {
  padding-bottom: 30px;
}
@media (max-width: 800px) {
  #qwrapper {
    flex-direction: column;
    align-items: center;
  }
}
@media screen and (max-width: 480px) {
  #qwrapper {
    flex-wrap: wrap;
  }
  .row {}
}
@media only screen and (min-width: 760px) {
  #qwrapper {
    justify-content: space-between;
    margin: 10px;
  }
  #lighticon {
    position: relative;
    margin-left: 100px;
  }
}
Run Code Online (Sandbox Code Playgroud)
<div id="qwrapper">

  <h3 id="michelle" class="row">"She always thinks of her clients."
<br>
   
</h3>

  <img src="https://cdn4.iconfinder.com/data/icons/black-icon-social-media/512/099310-feedburner-logo.png" class="row" alt="" id="lighticon" />

  <h3 id="jerry" class="row">"Very smart, creative person, problem solver."
<br>


</h3>
</div>
Run Code Online (Sandbox Code Playgroud)

Mic*_*l_B 11

justify-content属性使用行上的可用空间来定位弹性项目。

使用justify-content: space-between,所有可用空间都放置在第一个和最后一个项目之间,将两个项目推到容器的相对边缘。

你写了:

我想知道如何证明justify-content: space-betweenflexbox允许有多少空间。

对于space-between行方向,您必须控制 flex 容器的宽度。因此,如果您希望 flex 项目之间的空间更小,那么您需要缩短容器的宽度。

或者你可以使用justify-content: space-around.

然而,这些解决方案是次优的。

解决这个问题的正确方法是使用边距。

你写了:

目前,我的物品是有间隔的,但它们之间的空间太大了,我希望它们之间只留一点空间,这样它们就可以连续排列在中间的某个地方。

使用justify-content: center那么除了用利润空间他们。