简体   繁体   English

flex-direction 列无响应

[英]flex-direction column not responsive

I am facing a problem with flex-direction: column on responsive mode.我面临flex-direction: column的问题。 When I write flex-direction: column to .container its not wrapping to responsive like flex-direction: row , it's going outside of the layout.当我将flex-direction: column写入.container ,它不会像flex-direction: row那样包装为响应式,它超出了布局。 How to fix that?如何解决?

   <div class="content">
     <div class="container">

       <div class="box">First Name Man</div>
              <div class="box">First Name Man</div>
       <div class="box">First Name Man</div>
       <div class="box">First Name Man</div>

     </div>
   </div>
.content {
  width: 100%;
  min-height: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-wrap: wrap;
  background-color: whitesmoke;
}


.container {
  width: 100%;
  min-height: 500px;
   display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-wrap: wrap;

}

.box {
  width:700px;
  margin: 10px;
  color:white;
  min-height: 70px;

  display: flex;
  align-items: center;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

  justify-content: space-around;
  background-color: indigo;
  flex-direction: column;
  flex-wrap: wrap;
}

You have a fixed width setting for .box (700px).您有.box (700px) 的固定width设置。 Change that to width: calc(100% - 20px) (ie full width minus 20px for the margin left and right) in a media query, then it will work as desired.在媒体查询中将其更改为width: calc(100% - 20px) (即左右边距的全宽减去 20px),然后它将按需要工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM