<div id="app">
  <div class="header">
    <h2>Flex item property: {{key}}</h2>
    <div class="flex-layout flex-center"> 
    </div>
  </div>  

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

      <template v-for="item in values">
        <h3 class="row-title">{{item.title}}</h3>
        <div class="flex-container">
          <div v-for="(value) in item.values" class="flex-item" :style="`${key}: ${value}`">
            {{key}}: {{value}};<br>
            height: 100px;
          </div>
        </div>
      </template>
    </div>
  </div>
</div>
@default-color: fade(#1f2d3d, 70%);

@container-width: auto;
@content-min-width: 1670px;
@flex-container-width: 100%;
@flex-container-height: 500px;
@flex-container-padding: 0;
@flex-container-justify: space-around;

// @flex-item-size: 80px;
@flex-item-width: auto;
@flex-item-height: 100px;
@flex-item-margin: 16px;
@flex-item-font-size: 18px;
@flex-item-padding: 0px 16px;


// @flex-item-height-1: 30px;
// @flex-item-height-2: 80px;
// @flex-item-height-3: 50px;
// @flex-item-height-4: 140px;
// @flex-item-height-5: 80px;

body {
  margin: 0;
}

button {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 15px;
  color: rgb(17, 85, 204);
  border-radius: 500px;
  bottom: 16px;
  cursor: pointer;
  justify-content: center;
  min-width: 32px;
  background-color: rgb(255, 255, 255);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.23);

  & + & {
    margin-left: 12px;
  }

  &.disabled {
    color: #bbb;
    box-shadow: none;
    cursor: auto;
  }
}

// #app {
//   overflow: auto;
// }

.flex-layout {
  display: flex;
}

.flex-center {
  justify-content: center;
  align-items: center;
}

.container {
  overflow: auto;
}

.content {
  display: flex;
  flex-wrap: wrap;
  // justify-content: space-between;
  // width: @container-width;
  // max-width: 1200px;
  min-width: @content-min-width;
  margin: 20px auto;
  text-align: center;
  color: @default-color;
}

.header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 60px;
  padding: 0 20px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  background: #fff;
  box-sizing: border-box;
}

.flex-container {
  display: flex;
  // flex-wrap: wrap;
  width: @flex-container-width;
  height: @flex-container-height;
  padding: @flex-container-padding;
  justify-content: @flex-container-justify;
  margin: 20px;
  background: fade(#3a506b, 70%);

  & + & {
    margin-top: 20px;
  }
}

.flex-item {
  display: flex;
  justify-content: center;
  align-items: center;
  height: @flex-item-height;
  width: @flex-item-width;
  margin: @flex-item-margin;
  font-size: @flex-item-font-size;
  padding: @flex-item-padding;
  line-height: 2;
  transition: all 0.3s;

  &:nth-child(5n + 1) {
    background: #247ba0;
    color: fade(#fff, 70%);
  }
  &:nth-child(5n + 2) {
    background: #70c1b3;
  }
  &:nth-child(5n + 3) {
    background: #b2dbbf;
  }
  &:nth-child(5n + 4) {
    background: #f3ffbd;
  }
  &:nth-child(5n + 5) {
    background: #ff1654;
    color: fade(#fff, 70%);
  }
}

.line {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 50px auto 20px;
  width: @content-min-width;

  &:before {
    content: "";
    position: absolute;
    border-top: 2px solid @default-color;
    left: 0;
    right: 0;
    top: 16px;
    margin: auto;
    border-radius: 10px;
  }

  span {
    position: relative;
    display: inline;
    padding: 0 16px;
    background: #fff;
    font-size: 24px;
  }
}

.tips {
  text-align: left;
  margin: 30px 0;
  padding: 10px;
  border: 1px solid #ccc;
}

.row-title {
  text-align: center;
  width: 100%;
  font-size: 26px;
  margin: 0;
}
View Compiled
const property = 'align-self';
const values = [
  {
    title: '常用值一览',
    values: [ 
      'auto',
      'center',
      'flex-start',
      'flex-end',
      'normal',
      'stretch',
    ],
  },
  {
    title: '最新版 Firefox 已实现的功能',
    values: [ 
      'start',
      'end',
      'self-start',
      'self-end',
      'baseline',
      'first baseline',
      'last baseline',
    ],
  },
]

new Vue({
  el: '#app',
  data: {
    key: property,
    values: [...values],
    curIdx: 2,
    size: 520
  },
  methods: {
    changeSelect(e) {
      this.curIdx = e.target.value;
    },
    increase() {
      this.$set(this.values, this.curIdx, this.values[this.curIdx] + 1);
    },
    decrease() {
      const val = this.values[this.curIdx];
      if (!val) return;

      this.$set(this.values, this.curIdx, this.values[this.curIdx] - 1);
    },
    reset() {
      this.values = [...values]
    }
    
  }
})

View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdn.jsdelivr.net/npm/vue/dist/vue.js