html 弹性盒信息弹性盒

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 弹性盒信息弹性盒相关的知识,希望对你有一定的参考价值。


<style>
  @media(min-width:468px){
    .container-1{
      display:flex;
      /*
      align-items:flex-start;
      align-items:flex-end;
      align-items:center;
      
      flex-direction:column;
      */
    }
    
    .container-2{
      display:flex;  
      /*
      justify-content:flex-start;
      justify-content:flex-end;
      justify-content:center;
      justify-content:space-around;
      */
      justify-content:space-between;
    }
  }
  
  .container-3{
    display:flex;  
    flex-wrap:wrap;
    justify-content:space-between;
  }
  
  .container-1 div, .container-2 div, .container-3 div{
    border:1px #ccc solid;
    padding:10px;
  }
  
  .box-1{
    flex:2;
    order:2;
  }
  
  .box-2{
    flex:1;
    order:1;
  }
  
  .box-3{
    flex:1;
    order: 3;
  }
  
  .container-2-box{
    flex-basis: 27%;  
  }
  
  .container-3-box{
    flex-basis:12%;
  }
  
</style>


<div class="container-1">
  <div class="box-1">
    <h3>Box One</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
  </div>
  <div class="box-2">
    <h3>Box Two</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
  </div>
  <div class="box-3">
    <h3>Box Three</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
  </div>
</div>
  
<div class="container-2">
  <div class="container-2-box">
    <h3>Box Four</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-2-box">
    <h3>Box Five</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-2-box">
    <h3>Box Six</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
</div>

<div class="container-3">
  <div class="container-3-box">
    <h3>Box Seven</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-3-box">
    <h3>Box Eight</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-3-box">
    <h3>Box Nine</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-3-box">
    <h3>Box Ten</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-3-box">
    <h3>Box Eleven</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
  <div class="container-3-box">
    <h3>Box Twelve</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec elit urna. Suspendisse a erat a nibh imperdiet fermentum. In eleifend ultricies massa, id pretium purus convallis nec. </p>
  </div>
</div>

以上是关于html 弹性盒信息弹性盒的主要内容,如果未能解决你的问题,请参考以下文章

深入理解CSS弹性盒模型flex

弹性盒模型

CSS弹性盒模型flex在布局中的应用

css弹性布局是啥

CSS3弹性盒模型flex box快速入门 2016.03.16

Web前端之弹性盒简介