html – flex-items空间没有在小屏幕上分发

我试图添加对齐内容:space-between;因此两个flex元素之间的空间相等.

>注意红色div,两个项目内部都“卡在一起”,没有空格
在320px屏幕之间,大小:http://imgur.com/a/QAYcy
>再次,在856px屏幕中,没有分配空间,
http://imgur.com/a/y0iBp
>现在在1364px屏幕上正在分发空间,http://imgur.com/a/05tsj

我试图使用justify-content分配空间:space-between;

有任何想法吗?

/* SECTION THREE */
.sec-3 {
  background-color: #f1eeee;
  margin-top: -22px;
}

.sec-3-flex {
  background-color: red;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-around;
}

.sec-3-flex #iphone-2-img {
  padding-top: 30px;
  background-color: orange;
  margin-right: -10%;
}

.sec-3-flex .sales-copy-wrap {
  background-color: yellow;
}

#iphone-sec-3 {}
<div class="sec-3">
  <!-- iphone image  -->
  <div class="sec-3-flex">
    <!-- Iphone 1 image -->
    <picture id="iphone-sec-3">
      <!-- <source media="(min-width: 320px)" srcset="img/mobile/mobile-iphone-1.jpg"> -->
      <source media="(min-width: 320px)" srcset="img/desktop/images/home_11.jpg">
      <img id="iphone-2-img" src="img_orange_flowers.jpg" alt="Flowers" style="width:50%">
    </picture>
    <div class="sales-copy-wrap">
      <h3>Get organized with events, tasks and notes.</h3>
      <p class="sales-copy">Now more then ever it is critical for smart professionals to stay up to date with important deadlines.</p>
    </div>
  </div>
</div>

最佳答案 图像不是弹性项目.它是弹性项目(图片)的子项.

因此,在此弹性项目内,图像(自然地)与左侧对齐.

将其添加到您的代码中:

picture {
   text-align: right;
}
点赞