elementUI的栅格布局

el-row代表行,里面嵌套el-col,

el-row里面有gutter属性,属性为数字,则gutter前面加冒号,gutter属性代表el-col的间隔

el-col里面有span属性,span为x,则分成24/x列

el-col里必须有div,不然span分割无效

例子:

<template>
<div>
<el-row :gutter="20">
  <el-col :span="6"><div class="test">1</div></el-col>
  <el-col :span="6"><div class="test">1</div></el-col>
  <el-col :span="6"><div class="test">1</div></el-col>
  <el-col :span="6"><div class="test">1</div></el-col>
</el-row>
</div>
</template>
<script>
export default {
  name: "HelloWolrd",
  data () {
    return {
    };
  }
}
</script>
<style lang="css" scoped>
.test{
  background-color: red;
  color: #fff;
}
</style>

效果:

分享图片

相关文章
相关标签/搜索