scss Flex卡

Posted

tags:

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

<div class="container">
  <div class="cards">
    <div class="card">
      <div class="card-inner">Hello there</div>
    </div>
    <div class="card">
      <div class="card-inner">Hello there</div>
    </div>
    <div class="card">
      <div class="card-inner">Hello there</div>
    </div>
    <div class="card">
      <div class="card-inner">Hello there</div>
    </div>
    <div class="card">
      <div class="card-inner">Hello there</div>
    </div>
  </div>
</div>
/* Grid will not work without this */
*,* :before, *:after {
   box-sizing: border-box;
   -moz-box-sizing: border-box;
   -webkit-box-sizing: border-box;
}

body {
  color: white;
  font-family: sans-serif;
  font-weight: bold;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid red;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  width: calc(100% + 30px);
  
  margin: -15px;
}

.card {
  width:50%;
  @media(max-width:400px) {
    width: 50%;
  }
  padding: 15px;
}

.card-inner{
  background:blue;
}

以上是关于scss Flex卡的主要内容,如果未能解决你的问题,请参考以下文章

scss _flex-img.scss

scss Sass Flex Grid

scss 使用flex更改元素位置

scss Flex Snippets

scss Flex订单修复

scss cleanflex clearfix flex