Vuetify 之間隔等距

栏目: CSS · 发布时间: 5年前

内容简介:Flexbox 對於macOS Mojave 10.14.5Node 12.4.0

Flexbox 對於 間隔等距 ,主要由 justify-contentspace 系列設定;Vuetify 的 Grid 則提供 justify-space-betweenjustify-space-around 等 props,讓我們不用 CSS 即可排版。

Version

macOS Mojave 10.14.5

Node 12.4.0

Vue CLI 3.8.4

Vue 2.6.10

Vuetify 1.5.5

Chrome 75.0.3770.100

Vue File

<template>
  <v-container fluid>
    <v-layout justify-space-between row1>
      <v-flex xs4 item1>1</v-flex>
      <v-flex xs3 item2>2</v-flex>
      <v-flex xs4 item3>3</v-flex>
    </v-layout>
  </v-container>
</template>

<script>
export default {
  name: 'App',
}
</script>

<style scoped>
.row1 {
  background-color: #d3d3d3;
  height: 240px;
}

.item1 {
  background-color: #faa;
}

.item2 {
  background-color: #afa;
}

.item3 {
  background-color: #aff;
}
</style>

第 2 行

<v-container fluid>
  <v-layout justify-space-between row1>
    <v-flex xs4 item1>1</v-flex>
    <v-flex xs3 item2>2</v-flex>
    <v-flex xs4 item3>3</v-flex>
  </v-layout>
</v-container>

對 3 個 <div> 做 layout。

但已經看不到 <div> 與 CSS class,取而代之是 Vuetify 的 component 與 props。

Space Between

Vuetify 之間隔等距

RGB 並沒有均分 container,但 紫色 間距是相等的。

<v-container fluid>
  <v-layout justify-space-between row1>
    <v-flex xs4 item1>1</v-flex>
    <v-flex xs3 item2>2</v-flex>
    <v-flex xs4 item3>3</v-flex>
  </v-layout>
</v-container>

Vuetify 的 grid system 依次使用 <v-container><v-layout><v-flex>

<v-layout> 相當於 CSS 的 display: flex

<v-layout> 沒設定 column props,預設為 row ,表示內容 由左至右

justify-space-between 表示:

  • <v-flex><v-flex> 間隔平分 <v-container> 剩下寬度
  • 第一個 <v-flex> 與最後一個 <v-flex> 都貼齊 <v-container> ,不使用 <v-container> 剩下寬度

Vuetify 之間隔等距

justify-space-between 相當於 CSS 的 justify-content: space-between

Space Around

Vuetify 之間隔等距

RGB 並沒有均分 container,兩側間距為中間間距的一半。

<v-container fluid>
  <v-layout justify-space-around row1>
    <v-flex xs4 item1>1</v-flex>
    <v-flex xs3 item2>2</v-flex>
    <v-flex xs4 item3>3</v-flex>
  </v-layout>
</v-container>

justify-space-around 表示:

  • <v-flex><v-flex> 間隔平分 container 剩下寬度
  • 第一個 <v-flex> 與最後一個 <v-flex> 也會使用 <v-container> 剩下寬度,但只有 <v-flex><v-flex> 間寬度一半

Vuetify 之間隔等距

justify-space-around 相當於 CSS 的 justify-content: space-around

Space Evenly

Vuetify 之間隔等距

RGB 並沒有均分 container,兩側間距與中間間距相同。

<v-container fluid>
  <v-layout justify-space-evenly row1>
    <v-flex xs4 item1>1</v-flex>
    <v-flex xs3 item2>2</v-flex>
    <v-flex xs4 item3>3</v-flex>
  </v-layout>
</v-container>

justify-space-evenly 表示:

  • <v-flex><v-flex> 間隔平分 v-container 剩下寬度
  • 第一個 <v-flex> 與最後一個 <v-flex> 也會使用 <v-container> 剩下寬度,與 <v-flex><v-flex> 間寬度相等
<style scoped>
.justify-space-evenly {
  justify-content: space-evenly;
}
</style>

Vuetify 目前並沒有提供 justify-space-evenly props,若要達成相同效果,只能自己定義 justify-space-evenly class。

Vuetify 之間隔等距

使用自行定義的 justify-space-evenly class。

Conclusion

  • 實務上 justify-space-betweenjustify-space-around 較常使用,也因此 Vuetify 沒有提供 justify-space-evenly

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

计数组合学(第一卷)

计数组合学(第一卷)

斯坦利 / 付梅、侯庆虎、辛国策 / 高等教育 / 2009-6 / 42.00元

《计数组合学(第1卷)》是两卷本计数组合学基础导论中的第一卷,适用于研究生和数学研究人员。《计数组合学(第1卷)》主要介绍生成函数的理论及其应用,生成函数是计数组合学中的基本工具。《计数组合学(第1卷)》共分为四章,分别介绍了计数(适合高年级的本科生),筛法(包括容斥原理),偏序集以及有理生成函数。《计数组合学(第1卷)》提供了大量的习题,并几乎都给出了解答,它们不仅是对《计数组合学(第1卷)》正......一起来看看 《计数组合学(第一卷)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

随机密码生成器
随机密码生成器

多种字符组合密码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试