Flo*_*set 5 html css vue.js vuetify.js
我正在尝试使用 2 列的布局,我希望它们具有相同的高度,并且内部内容应垂直居中。
这是我在 vuetify 中的代码
<div id="app">
<v-app>
<v-row align="center">
<v-col cols=6 style="background-color: #FF5000;" align="center">
<v-btn class="m">Column 1</v-btn>
</v-col>
<v-col cols=6 style="background-color: #5fc3c7;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</v-col>
</v-row>
</v-app>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试将列更改<v-row align="center">为<v-row align="stretch">我想要的拉伸,但内容不居中。
Bla*_*yyy 14
正如Tingsen Cheng提到的,你可以添加flex样式v-col来实现垂直居中。此外,从 Vuetify 2.3.10 开始,您可以使用其Flex 助手,它为您提供实用程序类来轻松控制布局。
因此,style您可以使用类似这样的内容,而不是使用 inline :class="d-flex justify-center align-center"
<v-row align="stretch">
<v-col
cols="6"
style="background-color: #FF5000;"
class="d-flex justify-center align-center"
>
<v-btn>...</v-btn>
</v-col>
<v-col cols="6" style="background-color: #5fc3c7;">...</v-col>
</v-row>
Run Code Online (Sandbox Code Playgroud)
这是codesandbox上的演示。
| 归档时间: |
|
| 查看次数: |
14786 次 |
| 最近记录: |