API 浏览器
CSS 间距类

Quasar 提供了一些 CSS 类,可帮助你设置 DOM 元素或组件的间距。所有选项均以 q- 为前缀,然后分解为类型 (T)、方向 (D) 和大小 (S)。有关所有可能的排列,请参阅下表。

¥There are CSS classes supplied by Quasar to help you with spacing for DOM elements or components. All options are prefixed with q- and then broken down into type (T), direction (D), and size (S). See the table below for all possible permutations.

语法(Syntax)

¥Syntax

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)

示例(Examples)

¥Examples

<!-- 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 插件(Flex Addons)

¥Flex Addons

启用后(通过 quasar.config file > framework > cssAddon: true),它会为所有与间距相关的 CSS 类提供断点感知版本。

¥When enabled (through quasar.config file > framework > cssAddon: true) it provides breakpoint aware versions for all spacing related CSS classes.

请注意,启用此功能后,CSS 占用空间会明显增加。因此,只有在真正需要时才这样做。

¥Note that there will be a noticeable bump in CSS footprint when enabling it. So only do it if you really need it.

.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

¥Examples: q-pa-xs-md q-pa-sm-sm q-px-md-lg q-py-md-md

排列表(Table of permutations)

¥Table of permutations

前缀类型方向尺寸示例
q-p(内边距)t(顶部)noneq-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(右)noneq-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(底部)noneq-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(左)noneq-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(全部)noneq-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(左侧 &右)noneq-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(顶部和底部)noneq-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(顶部)noneq-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(顶部)autoq-mt-auto
q-m(边距)r(右)noneq-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(右)autoq-mr-auto
q-m(边距)b(底部)noneq-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(底部)autoq-mb-auto
q-m(边距)l(左)noneq-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(左)autoq-ml-auto
q-m(边距)a(全部)noneq-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(左侧 &右)noneq-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(左侧 &右)autoq-mx-auto
q-m(边距)y(顶部和底部)noneq-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(顶部和底部)autoq-my-auto

提示

查看有关 Flex 插件 的更多详细信息。

¥See more details about the Flex Addons.

¥Other Related

类名描述
no-margin移除所有应用的边距
no-padding移除所有应用的填充