ElementU 01 布局

2020-09-16  本文已影响0人  时间领主timeloader

框架使用

在使用elemfentUI 的时候要配合Vue或者React脚本来使用,不然无法预览效果,我这里使用的vue 框架,所以

在html要实例化Vue,并且绑定到 租间房父布局,例如:


<html > 

<head>

  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">

  <!-- import Vue before Element -->

  <script src="https://unpkg.com/vue/dist/vue.js"></script>

  <!-- import JavaScript -->

  <script src="https://unpkg.com/element-ui/lib/index.js"></script>

</head>

<body>

<div id="app">

  <el-button>

  登录  

  </el-button>

</div>

</body>

<script>

var vm=new Vue({

el:"#app",

})

</script>

</html>

CSS居中

div 居中

设置div的宽高,然后设置

margin:0 auto ,可以让子元素居中

块级元素水平居中

设置 父布局

text-align:center来设置水平居中

flex布局居中

设置父布局为flex,布局并且设置


display:flex;

align-items:center;

layout 布局

el-row 标签和el-col来配合显示行列布局:


<el-row>

<el-clo>

  <div span="12" style="background-color:red">

    <div span="12" style="background-color:green">

  </div>

</el-clo>

</el-row>

详细属性

【Row 属性】

-align 布局在flex布局下,参数有top | middle |bottom |

【Col 属性】

Container布局容器

为了方便开发,设计出了布局容器el-container,作为父布局,只能包含四种子子布局:

【注】:el-container中,包含el-asideel-main的时候,布局时从左到右,包含el-headerel-footer的时候,就会布局从上到下,el-aside中布局也是从上到下.


<body>

 <div id="app">

   <el-container>

    <el-header style="background-color: black;" >

    </el-header>

   </el-container>

<el-container>

<el-aside style=" background-color: red; height: 500px; width: 200px;">

</el-aside>

<el-main style=" background-color: green; height: 500px; width: 200px;" >

</el-main>

</el-container>

<el-container>

  <el-footer style="background-color: hotpink;">

  </el-footer>

</el-container>

</div>

</body>

<script>

    new Vue().$mount('#app')

</script>

</html>

Button按钮

el-button 来显示 按钮

其中属性包括:

文字链接

el-link 来显示文字链接。主要使用的属性有:

el-radio单选 & el-radio-button 单选按钮

上一篇 下一篇

猜你喜欢

热点阅读