0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/scss/_utilities.scss

711 lines
16 KiB
SCSS
Raw Normal View History

2019-05-23 11:56:03 +02:00
// Utilities
$utilities: () !default;
// stylelint-disable-next-line scss/dollar-variable-default
$utilities: map-merge(
(
// scss-docs-start utils-vertical-align
2019-05-23 11:56:03 +02:00
"align": (
property: vertical-align,
class: align,
values: baseline top middle bottom text-bottom text-top
),
// scss-docs-end utils-vertical-align
// scss-docs-start utils-float
2019-05-23 11:56:03 +02:00
"float": (
responsive: true,
property: float,
values: (
start: left,
end: right,
none: none,
)
2019-05-23 11:56:03 +02:00
),
// scss-docs-end utils-float
Utilities for overflow and object fit (#36848) * Added "overflow-x" and "overflow-y" - Having the same properties as overflow but for just the x and y axises - Usecase being I want my y axis to be scrollable but not my x axis - E.g a card with a vertical list of items. * Added "object-fit" utilities - The CSS object-fit property is used to specify how an <img> or <video> should be resized to fit its container. - A responsive alternative to using background-img for a resizable fill/fit image. * Updated documantation for the overflow utilities - Now includes docs for `overflow-x` and `overflow-y` utilities * Placeholder shortcode updated - Can now choose to render an img tag or svg - The image contains a base64 svg generated within the template - example shortcode updated to detect, replace and render preview of 'img' tags as well * New documentaion for Object Fit added - Documentation added for the 'object-fit' util * Updated spell checks issues * Update object-fit.md * Update overflow.md * Update object-fit.md * Updated markup to address HTML Validation Errors - error: Bad value for attribute "src" on element "img": Illegal character in scheme data: space is not allowed. - info warning: Self-closing tag syntax in text/html documents is widely discouraged; it's unnecessary and interacts badly with other HTML features (e.g., unquoted attribute values). If you're using a tool that injects self-closing tag syntax into all void elements, without any option to prevent it from doing so, then consider switching to a different tool. * Updated Fix - Added Legibility to the img markup (example.html) - Fixed issue with example not working properly (because image closing tag no longer has "/>" ) * update values by step of 0.25 in bundlewatch.config The following values in .bundlewatch.config.json have been updated: - ./dist/css/bootstrap-utilities.css - ./dist/css/bootstrap-utilities.min.css - ./dist/css/bootstrap.css - ./dist/css/bootstrap.min.css Co-authored-by: Daniel O <dobiekwe@byteworks.com.ng> Co-authored-by: Mark Otto <otto@github.com>
2022-10-06 22:14:11 +02:00
// Object Fit utilities
// scss-docs-start utils-object-fit
"object-fit": (
responsive: true,
property: object-fit,
values: (
contain: contain,
cover: cover,
fill: fill,
scale: scale-down,
none: none,
)
),
// scss-docs-end utils-object-fit
// Opacity utilities
// scss-docs-start utils-opacity
"opacity": (
property: opacity,
values: (
0: 0,
25: .25,
50: .5,
75: .75,
100: 1,
)
),
// scss-docs-end utils-opacity
// scss-docs-start utils-overflow
2019-05-23 11:56:03 +02:00
"overflow": (
property: overflow,
2020-07-21 10:24:38 +02:00
values: auto hidden visible scroll,
2019-05-23 11:56:03 +02:00
),
Utilities for overflow and object fit (#36848) * Added "overflow-x" and "overflow-y" - Having the same properties as overflow but for just the x and y axises - Usecase being I want my y axis to be scrollable but not my x axis - E.g a card with a vertical list of items. * Added "object-fit" utilities - The CSS object-fit property is used to specify how an <img> or <video> should be resized to fit its container. - A responsive alternative to using background-img for a resizable fill/fit image. * Updated documantation for the overflow utilities - Now includes docs for `overflow-x` and `overflow-y` utilities * Placeholder shortcode updated - Can now choose to render an img tag or svg - The image contains a base64 svg generated within the template - example shortcode updated to detect, replace and render preview of 'img' tags as well * New documentaion for Object Fit added - Documentation added for the 'object-fit' util * Updated spell checks issues * Update object-fit.md * Update overflow.md * Update object-fit.md * Updated markup to address HTML Validation Errors - error: Bad value for attribute "src" on element "img": Illegal character in scheme data: space is not allowed. - info warning: Self-closing tag syntax in text/html documents is widely discouraged; it's unnecessary and interacts badly with other HTML features (e.g., unquoted attribute values). If you're using a tool that injects self-closing tag syntax into all void elements, without any option to prevent it from doing so, then consider switching to a different tool. * Updated Fix - Added Legibility to the img markup (example.html) - Fixed issue with example not working properly (because image closing tag no longer has "/>" ) * update values by step of 0.25 in bundlewatch.config The following values in .bundlewatch.config.json have been updated: - ./dist/css/bootstrap-utilities.css - ./dist/css/bootstrap-utilities.min.css - ./dist/css/bootstrap.css - ./dist/css/bootstrap.min.css Co-authored-by: Daniel O <dobiekwe@byteworks.com.ng> Co-authored-by: Mark Otto <otto@github.com>
2022-10-06 22:14:11 +02:00
"overflow-x": (
property: overflow-x,
values: auto hidden visible scroll,
),
"overflow-y": (
property: overflow-y,
values: auto hidden visible scroll,
),
// scss-docs-end utils-overflow
// scss-docs-start utils-display
2019-05-23 11:56:03 +02:00
"display": (
responsive: true,
print: true,
property: display,
class: d,
values: inline inline-block block grid table table-row table-cell flex inline-flex none
2019-05-23 11:56:03 +02:00
),
// scss-docs-end utils-display
// scss-docs-start utils-shadow
2019-05-23 11:56:03 +02:00
"shadow": (
property: box-shadow,
class: shadow,
values: (
null: $box-shadow,
2020-03-15 21:21:19 +01:00
sm: $box-shadow-sm,
2019-05-23 11:56:03 +02:00
lg: $box-shadow-lg,
none: none,
)
),
// scss-docs-end utils-shadow
// scss-docs-start utils-position
2019-05-23 11:56:03 +02:00
"position": (
property: position,
values: static relative absolute fixed sticky
),
"top": (
property: top,
values: $position-values
),
"bottom": (
property: bottom,
values: $position-values
),
"start": (
property: left,
class: start,
values: $position-values
),
"end": (
property: right,
class: end,
values: $position-values
),
"translate-middle": (
property: transform,
class: translate-middle,
values: (
null: translate(-50%, -50%),
x: translateX(-50%),
y: translateY(-50%),
)
),
// scss-docs-end utils-position
// scss-docs-start utils-borders
2019-05-23 11:56:03 +02:00
"border": (
property: border,
values: (
null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
2019-05-23 11:56:03 +02:00
0: 0,
)
),
"border-top": (
property: border-top,
values: (
null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
2019-05-23 11:56:03 +02:00
0: 0,
)
),
"border-end": (
2019-05-23 11:56:03 +02:00
property: border-right,
class: border-end,
2019-05-23 11:56:03 +02:00
values: (
null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
2019-05-23 11:56:03 +02:00
0: 0,
)
),
"border-bottom": (
property: border-bottom,
values: (
null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
2019-05-23 11:56:03 +02:00
0: 0,
)
),
"border-start": (
2019-05-23 11:56:03 +02:00
property: border-left,
class: border-start,
2019-05-23 11:56:03 +02:00
values: (
null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
2019-05-23 11:56:03 +02:00
0: 0,
)
),
"border-color": (
property: border-color,
2019-05-23 11:56:03 +02:00
class: border,
local-vars: (
"border-opacity": 1
),
values: $utilities-border-colors
2019-05-23 11:56:03 +02:00
),
"border-width": (
css-var: true,
2022-03-01 15:43:33 +01:00
css-variable-name: border-width,
class: border,
values: $border-widths
),
"border-opacity": (
css-var: true,
class: border-opacity,
values: (
10: .1,
25: .25,
50: .5,
75: .75,
100: 1
)
),
// scss-docs-end utils-borders
2019-05-23 11:56:03 +02:00
// Sizing utilities
// scss-docs-start utils-sizing
2019-05-23 11:56:03 +02:00
"width": (
property: width,
class: w,
values: (
25: 25%,
50: 50%,
75: 75%,
100: 100%,
auto: auto
)
),
"max-width": (
property: max-width,
class: mw,
values: (100: 100%)
),
"viewport-width": (
property: width,
class: vw,
values: (100: 100vw)
),
"min-viewport-width": (
property: min-width,
class: min-vw,
values: (100: 100vw)
),
2019-05-23 11:56:03 +02:00
"height": (
property: height,
class: h,
values: (
25: 25%,
50: 50%,
75: 75%,
100: 100%,
auto: auto
)
),
"max-height": (
property: max-height,
class: mh,
values: (100: 100%)
),
"viewport-height": (
property: height,
class: vh,
values: (100: 100vh)
),
"min-viewport-height": (
property: min-height,
class: min-vh,
values: (100: 100vh)
),
// scss-docs-end utils-sizing
2019-05-23 11:56:03 +02:00
// Flex utilities
// scss-docs-start utils-flex
2019-05-23 11:56:03 +02:00
"flex": (
responsive: true,
property: flex,
values: (fill: 1 1 auto)
),
"flex-direction": (
responsive: true,
property: flex-direction,
class: flex,
values: row column row-reverse column-reverse
),
"flex-grow": (
responsive: true,
property: flex-grow,
class: flex,
values: (
grow-0: 0,
grow-1: 1,
)
),
"flex-shrink": (
responsive: true,
property: flex-shrink,
class: flex,
values: (
shrink-0: 0,
shrink-1: 1,
)
),
"flex-wrap": (
responsive: true,
property: flex-wrap,
class: flex,
values: wrap nowrap wrap-reverse
),
"justify-content": (
responsive: true,
property: justify-content,
values: (
start: flex-start,
end: flex-end,
center: center,
between: space-between,
around: space-around,
evenly: space-evenly,
2019-05-23 11:56:03 +02:00
)
),
"align-items": (
responsive: true,
property: align-items,
values: (
start: flex-start,
end: flex-end,
center: center,
baseline: baseline,
stretch: stretch,
)
),
"align-content": (
responsive: true,
property: align-content,
values: (
start: flex-start,
end: flex-end,
center: center,
between: space-between,
around: space-around,
stretch: stretch,
)
),
"align-self": (
responsive: true,
property: align-self,
values: (
auto: auto,
start: flex-start,
end: flex-end,
center: center,
baseline: baseline,
stretch: stretch,
)
),
"order": (
responsive: true,
property: order,
values: (
first: -1,
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
last: 6,
2019-05-23 11:56:03 +02:00
),
),
// scss-docs-end utils-flex
2019-05-23 11:56:03 +02:00
// Margin utilities
// scss-docs-start utils-spacing
2019-05-23 11:56:03 +02:00
"margin": (
responsive: true,
property: margin,
class: m,
values: map-merge($spacers, (auto: auto))
),
"margin-x": (
responsive: true,
property: margin-right margin-left,
class: mx,
values: map-merge($spacers, (auto: auto))
),
"margin-y": (
responsive: true,
property: margin-top margin-bottom,
class: my,
values: map-merge($spacers, (auto: auto))
),
"margin-top": (
responsive: true,
property: margin-top,
class: mt,
values: map-merge($spacers, (auto: auto))
),
"margin-end": (
2019-05-23 11:56:03 +02:00
responsive: true,
property: margin-right,
class: me,
2019-05-23 11:56:03 +02:00
values: map-merge($spacers, (auto: auto))
),
"margin-bottom": (
responsive: true,
property: margin-bottom,
class: mb,
values: map-merge($spacers, (auto: auto))
),
"margin-start": (
2019-05-23 11:56:03 +02:00
responsive: true,
property: margin-left,
class: ms,
2019-05-23 11:56:03 +02:00
values: map-merge($spacers, (auto: auto))
),
// Negative margin utilities
"negative-margin": (
responsive: true,
property: margin,
class: m,
values: $negative-spacers
),
"negative-margin-x": (
responsive: true,
property: margin-right margin-left,
class: mx,
values: $negative-spacers
),
"negative-margin-y": (
responsive: true,
property: margin-top margin-bottom,
class: my,
values: $negative-spacers
),
"negative-margin-top": (
responsive: true,
property: margin-top,
class: mt,
values: $negative-spacers
),
"negative-margin-end": (
2019-05-23 11:56:03 +02:00
responsive: true,
property: margin-right,
class: me,
2019-05-23 11:56:03 +02:00
values: $negative-spacers
),
"negative-margin-bottom": (
responsive: true,
property: margin-bottom,
class: mb,
values: $negative-spacers
),
"negative-margin-start": (
2019-05-23 11:56:03 +02:00
responsive: true,
property: margin-left,
class: ms,
2019-05-23 11:56:03 +02:00
values: $negative-spacers
),
// Padding utilities
"padding": (
responsive: true,
property: padding,
class: p,
values: $spacers
),
"padding-x": (
responsive: true,
property: padding-right padding-left,
class: px,
values: $spacers
),
"padding-y": (
responsive: true,
property: padding-top padding-bottom,
class: py,
values: $spacers
),
"padding-top": (
responsive: true,
property: padding-top,
class: pt,
values: $spacers
),
"padding-end": (
2019-05-23 11:56:03 +02:00
responsive: true,
property: padding-right,
class: pe,
2019-05-23 11:56:03 +02:00
values: $spacers
),
"padding-bottom": (
responsive: true,
property: padding-bottom,
class: pb,
values: $spacers
),
"padding-start": (
2019-05-23 11:56:03 +02:00
responsive: true,
property: padding-left,
class: ps,
2019-05-23 11:56:03 +02:00
values: $spacers
),
// Gap utility
"gap": (
responsive: true,
property: gap,
class: gap,
values: $spacers
),
// scss-docs-end utils-spacing
2019-05-23 11:56:03 +02:00
// Text
// scss-docs-start utils-text
"font-family": (
property: font-family,
class: font,
values: (monospace: var(--#{$prefix}font-monospace))
),
"font-size": (
rfs: true,
property: font-size,
class: fs,
values: $font-sizes
),
"font-style": (
property: font-style,
class: fst,
values: italic normal
),
2019-05-23 11:56:03 +02:00
"font-weight": (
property: font-weight,
class: fw,
2019-05-23 11:56:03 +02:00
values: (
lighter: $font-weight-lighter,
light: $font-weight-light,
2019-05-23 11:56:03 +02:00
normal: $font-weight-normal,
medium: $font-weight-medium,
semibold: $font-weight-semibold,
bold: $font-weight-bold,
2019-05-23 11:56:03 +02:00
bolder: $font-weight-bolder
)
),
"line-height": (
property: line-height,
class: lh,
values: (
1: 1,
sm: $line-height-sm,
base: $line-height-base,
lg: $line-height-lg,
)
2019-05-23 11:56:03 +02:00
),
"text-align": (
responsive: true,
property: text-align,
class: text,
values: (
start: left,
end: right,
center: center,
)
2019-05-23 11:56:03 +02:00
),
"text-decoration": (
property: text-decoration,
values: none underline line-through
),
"text-transform": (
property: text-transform,
class: text,
values: lowercase uppercase capitalize
),
"white-space": (
property: white-space,
class: text,
values: (
wrap: normal,
nowrap: nowrap,
)
),
"word-wrap": (
property: word-wrap word-break,
class: text,
values: (break: break-word),
rtl: false
),
// scss-docs-end utils-text
// scss-docs-start utils-color
2019-05-23 11:56:03 +02:00
"color": (
property: color,
class: text,
local-vars: (
"text-opacity": 1
),
values: map-merge(
$utilities-text-colors,
(
"muted": $text-muted,
"black-50": rgba($black, .5), // deprecated
"white-50": rgba($white, .5), // deprecated
"reset": inherit,
)
2019-05-23 11:56:03 +02:00
)
),
"text-opacity": (
css-var: true,
class: text-opacity,
values: (
25: .25,
50: .5,
75: .75,
100: 1
)
),
// scss-docs-end utils-color
// scss-docs-start utils-bg-color
2019-05-23 11:56:03 +02:00
"background-color": (
property: background-color,
class: bg,
local-vars: (
"bg-opacity": 1
),
2019-05-23 11:56:03 +02:00
values: map-merge(
$utilities-bg-colors,
2019-05-23 11:56:03 +02:00
(
"transparent": transparent
2019-05-23 11:56:03 +02:00
)
)
),
"bg-opacity": (
css-var: true,
class: bg-opacity,
values: (
10: .1,
25: .25,
50: .5,
75: .75,
100: 1
)
),
// scss-docs-end utils-bg-color
"gradient": (
property: background-image,
class: bg,
values: (gradient: var(--#{$prefix}gradient))
),
// scss-docs-start utils-interaction
"user-select": (
property: user-select,
values: all auto none
),
2020-02-23 01:07:33 +01:00
"pointer-events": (
property: pointer-events,
class: pe,
values: none auto,
),
// scss-docs-end utils-interaction
// scss-docs-start utils-border-radius
2019-05-23 11:56:03 +02:00
"rounded": (
property: border-radius,
class: rounded,
values: (
null: var(--#{$prefix}border-radius),
2019-05-23 11:56:03 +02:00
0: 0,
1: var(--#{$prefix}border-radius-sm),
2: var(--#{$prefix}border-radius),
3: var(--#{$prefix}border-radius-lg),
4: var(--#{$prefix}border-radius-xl),
5: var(--#{$prefix}border-radius-2xl),
circle: 50%,
pill: var(--#{$prefix}border-radius-pill)
2019-05-23 11:56:03 +02:00
)
),
"rounded-top": (
property: border-top-left-radius border-top-right-radius,
class: rounded-top,
values: (
null: var(--#{$prefix}border-radius),
0: 0,
1: var(--#{$prefix}border-radius-sm),
2: var(--#{$prefix}border-radius),
3: var(--#{$prefix}border-radius-lg),
4: var(--#{$prefix}border-radius-xl),
5: var(--#{$prefix}border-radius-2xl),
circle: 50%,
pill: var(--#{$prefix}border-radius-pill)
)
2019-05-23 11:56:03 +02:00
),
"rounded-end": (
2019-05-23 11:56:03 +02:00
property: border-top-right-radius border-bottom-right-radius,
class: rounded-end,
values: (
null: var(--#{$prefix}border-radius),
0: 0,
1: var(--#{$prefix}border-radius-sm),
2: var(--#{$prefix}border-radius),
3: var(--#{$prefix}border-radius-lg),
4: var(--#{$prefix}border-radius-xl),
5: var(--#{$prefix}border-radius-2xl),
circle: 50%,
pill: var(--#{$prefix}border-radius-pill)
)
2019-05-23 11:56:03 +02:00
),
"rounded-bottom": (
property: border-bottom-right-radius border-bottom-left-radius,
class: rounded-bottom,
values: (
null: var(--#{$prefix}border-radius),
0: 0,
1: var(--#{$prefix}border-radius-sm),
2: var(--#{$prefix}border-radius),
3: var(--#{$prefix}border-radius-lg),
4: var(--#{$prefix}border-radius-xl),
5: var(--#{$prefix}border-radius-2xl),
circle: 50%,
pill: var(--#{$prefix}border-radius-pill)
)
2019-05-23 11:56:03 +02:00
),
"rounded-start": (
2019-05-23 11:56:03 +02:00
property: border-bottom-left-radius border-top-left-radius,
class: rounded-start,
values: (
null: var(--#{$prefix}border-radius),
0: 0,
1: var(--#{$prefix}border-radius-sm),
2: var(--#{$prefix}border-radius),
3: var(--#{$prefix}border-radius-lg),
4: var(--#{$prefix}border-radius-xl),
5: var(--#{$prefix}border-radius-2xl),
circle: 50%,
pill: var(--#{$prefix}border-radius-pill)
)
2019-05-23 11:56:03 +02:00
),
// scss-docs-end utils-border-radius
// scss-docs-start utils-visibility
"visibility": (
property: visibility,
class: null,
values: (
visible: visible,
invisible: hidden,
)
)
// scss-docs-end utils-visibility
2019-05-23 11:56:03 +02:00
),
$utilities
);