為何捐款
API 瀏覽器
CSS 間距類別

Quasar 提供了 CSS 類別,協助您設定 DOM 元素或元件的間距。所有選項都以 q- 為前綴,然後細分為類型 (T)、方向 (D) 和大小 (S)。請參閱下表,查看所有可能的排列組合。

語法

q-[p|m][t|r|b|l|a|x|y]-[none|auto|xs|sm|md|lg|xl]
    T       D                   S

T - type
  - values: p (padding), m (margin)

D - direction
  - values:
      t (top), r (right), b (bottom), l (left),
      a (all), x (both left & right), y (both top & bottom)

S - size
  - values:
      none,
      auto (ONLY for specific margins: q-ml-*, q-mr-*, q-mx-*),
      xs (extra small),
      sm (small),
      md (medium),
      lg (large),
      xl (extra large)

範例

<!-- small padding in all directions -->
<div class="q-pa-sm">...</div>

<!-- medium margin to top, small margin to right -->
<q-card class="q-mt-md q-mr-sm">...</q-card>

Flex 附加元件

啟用時 (透過 quasar.config file > framework > cssAddon: true),它會為所有與間距相關的 CSS 類別提供感知斷點的版本。

請注意,啟用它會顯著增加 CSS 佔用空間。因此,只有在您真正需要時才啟用。

.q-(p|m)(t|r|b|l|a|x|y)-<bp>-(none|auto|xs|sm|md|lg|xl)

範例:q-pa-xs-md q-pa-sm-sm q-px-md-lg q-py-md-md

排列組合表

前綴類型方向大小範例
q-p (內邊距)t (上)q-pt-none
q-p (內邊距)t (上)xs (超小)q-pt-xs
q-p (內邊距)t (上)sm (小)q-pt-sm
q-p (內邊距)t (上)md (中)q-pt-md
q-p (內邊距)t (上)lg (大)q-pt-lg
q-p (內邊距)t (上)xl (超大)q-pt-xl
q-p (內邊距)r (右)q-pr-none
q-p (內邊距)r (右)xs (超小)q-pr-xs
q-p (內邊距)r (右)sm (小)q-pr-sm
q-p (內邊距)r (右)md (中)q-pr-md
q-p (內邊距)r (右)lg (大)q-pr-lg
q-p (內邊距)r (右)xl (超大)q-pr-xl
q-p (內邊距)b (下)q-pb-none
q-p (內邊距)b (下)xs (超小)q-pb-xs
q-p (內邊距)b (下)sm (小)q-pb-sm
q-p (內邊距)b (下)md (中)q-pb-md
q-p (內邊距)b (下)lg (大)q-pb-lg
q-p (內邊距)b (下)xl (超大)q-pb-xl
q-p (內邊距)l (左)q-pl-none
q-p (內邊距)l (左)xs (超小)q-pl-xs
q-p (內邊距)l (左)sm (小)q-pl-sm
q-p (內邊距)l (左)md (中)q-pl-md
q-p (內邊距)l (左)lg (大)q-pl-lg
q-p (內邊距)l (左)xl (超大)q-pl-xl
q-p (內邊距)a (全部)q-pa-none
q-p (內邊距)a (全部)xs (超小)q-pa-xs
q-p (內邊距)a (全部)sm (小)q-pa-sm
q-p (內邊距)a (全部)md (中)q-pa-md
q-p (內邊距)a (全部)lg (大)q-pa-lg
q-p (內邊距)a (全部)xl (超大)q-pa-xl
q-p (內邊距)x (左右)q-px-none
q-p (內邊距)x (左右)xs (超小)q-px-xs
q-p (內邊距)x (左右)sm (小)q-px-sm
q-p (內邊距)x (左右)md (中)q-px-md
q-p (內邊距)x (左右)lg (大)q-px-lg
q-p (內邊距)x (左右)xl (超大)q-px-xl
q-p (內邊距)y (上下)q-py-none
q-p (內邊距)y (上下)xs (超小)q-py-xs
q-p (內邊距)y (上下)sm (小)q-py-sm
q-p (內邊距)y (上下)md (中)q-py-md
q-p (內邊距)y (上下)lg (大)q-py-lg
q-p (內邊距)y (上下)xl (超大)q-py-xl
q-m (外邊距)t (上)q-mt-none
q-m (外邊距)t (上)xs (超小)q-mt-xs
q-m (外邊距)t (上)sm (小)q-mt-sm
q-m (外邊距)t (上)md (中)q-mt-md
q-m (外邊距)t (上)lg (大)q-mt-lg
q-m (外邊距)t (上)xl (超大)q-mt-xl
q-m (外邊距)t (上)自動q-mt-auto
q-m (外邊距)r (右)q-mr-none
q-m (外邊距)r (右)xs (超小)q-mr-xs
q-m (外邊距)r (右)sm (小)q-mr-sm
q-m (外邊距)r (右)md (中)q-mr-md
q-m (外邊距)r (右)lg (大)q-mr-lg
q-m (外邊距)r (右)xl (超大)q-mr-xl
q-m (外邊距)r (右)自動q-mr-auto
q-m (外邊距)b (下)q-mb-none
q-m (外邊距)b (下)xs (超小)q-mb-xs
q-m (外邊距)b (下)sm (小)q-mb-sm
q-m (外邊距)b (下)md (中)q-mb-md
q-m (外邊距)b (下)lg (大)q-mb-lg
q-m (外邊距)b (下)xl (超大)q-mb-xl
q-m (外邊距)b (下)自動q-mb-auto
q-m (外邊距)l (左)q-ml-none
q-m (外邊距)l (左)xs (超小)q-ml-xs
q-m (外邊距)l (左)sm (小)q-ml-sm
q-m (外邊距)l (左)md (中)q-ml-md
q-m (外邊距)l (左)lg (大)q-ml-lg
q-m (外邊距)l (左)xl (超大)q-ml-xl
q-m (外邊距)l (左)自動q-ml-auto
q-m (外邊距)a (全部)q-ma-none
q-m (外邊距)a (全部)xs (超小)q-ma-xs
q-m (外邊距)a (全部)sm (小)q-ma-sm
q-m (外邊距)a (全部)md (中)q-ma-md
q-m (外邊距)a (全部)lg (大)q-ma-lg
q-m (外邊距)a (全部)xl (超大)q-ma-xl
q-m (外邊距)x (左右)q-mx-none
q-m (外邊距)x (左右)xs (超小)q-mx-xs
q-m (外邊距)x (左右)sm (小)q-mx-sm
q-m (外邊距)x (左右)md (中)q-mx-md
q-m (外邊距)x (左右)lg (大)q-mx-lg
q-m (外邊距)x (左右)xl (超大)q-mx-xl
q-m (外邊距)x (左右)自動q-mx-auto
q-m (外邊距)y (上下)q-my-none
q-m (外邊距)y (上下)xs (超小)q-my-xs
q-m (外邊距)y (上下)sm (小)q-my-sm
q-m (外邊距)y (上下)md (中)q-my-md
q-m (外邊距)y (上下)lg (大)q-my-lg
q-m (外邊距)y (上下)xl (超大)q-my-xl
q-m (外邊距)y (上下)自動q-my-auto

提示

請參閱Flex 附加元件以了解更多詳細資訊。

類別名稱描述
no-margin移除所有已套用的外邊距
no-padding移除所有已套用的內邊距