<el-row> <el-col :span="12"> </el-col> <el-col :span="12"> </el-col> </el-row>怎么再将el-col分成1:2的两部分
时间: 2024-02-09 15:09:33 浏览: 179
你可以在每个 `el-col` 中再嵌套一个 `el-row`,然后在其中分别再添加两个 `el-col`,并设置它们的 `span` 属性为6和12,代码如下:
```
<el-row>
<el-col :span="12">
<el-row>
<el-col :span="6"></el-col>
<el-col :span="6"></el-col>
</el-row>
</el-col>
<el-col :span="12">
<el-row>
<el-col :span="6"></el-col>
<el-col :span="6"></el-col>
</el-row>
</el-col>
</el-row>
```
这样,每个 `el-col` 就被分成了两个宽度比例为1:2的部分。
相关问题
<el-form label-position="left"> <el-row> <el-col :span="4"> <el-form-item label="姓名"> <el-input></el-input> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="年龄"> <el-input></el-input> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="性别"> <el-radio-group> <el-radio label="male">男</el-radio> <el-radio label="female">女</el-radio> </el-radio-group> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="地址"> <el-input></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="邮箱"> <el-input></el-input> </el-form-item> </el-col> </el-row> </el-form> 如何使表单的标签显示在左侧
可以通过设置 `label-position` 属性为 "left" 来使表单的标签显示在左侧,具体代码如下:
```html
<el-form label-position="left">
<!-- 表单内容 -->
</el-form>
```
这样表单中每个表单项的标签都会显示在左侧。
怎么写能让这五个等分,<el-row :gutter="25"> <el-col :span="5"><div class="grid-content bg-purple"></div></el-col> <el-col :span="5"><div class="grid-content bg-purple"></div></el-col> <el-col :span="5"><div class="grid-content bg-purple"></div></el-col> <el-col :span="5"><div class="grid-content bg-purple"></div></el-col> <el-col :span="5"><div class="grid-content bg-purple"></div></el-col> </el-row>
您可以将 `<el-row>` 的 `span` 属性设置为 24,然后将每个 `<el-col>` 的 `span` 属性设置为 5,这样每个 `<el-col>` 就是等分的了。
代码示例:
```html
<el-row :gutter="25" :span="24">
<el-col :span="5"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="5"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="5"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="5"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="5"><div class="grid-content bg-purple"></div></el-col>
</el-row>
```
这样就可以实现五个等分了。
阅读全文