Object Utilities ​

The object utilities provide classes for controlling how an image fits inside its box and which part stays in view when it’s cropped.

Object Fit ​

Use an object fit class on an image with a set width and height to control whether it scales, stretches, or crops to fit.

Class NamePropertyValue
.object-fit-fillobject-fitfill
.object-fit-containobject-fitcontain
.object-fit-coverobject-fitcover
.object-fit-noneobject-fitnone
.object-fit-scale-downobject-fitscale-down

Object Position ​

Use an object position class to move the crop. The square frame crops the sides, and the wide frame crops the top and bottom.

Class NamePropertyValue
.object-position-topobject-positiontop
.object-position-rightobject-positionright
.object-position-bottomobject-positionbottom
.object-position-leftobject-positionleft
.object-position-centerobject-positioncenter

Installation ​

Stylesheets ​

The full graupl.css stylesheet includes these styles. To load them separately, use one of the options below.

html
<link rel="stylesheet" href="./dist/css/utilities/object.css">
html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@graupl/graupl@1.0.0-beta.58/dist/css/utilities/object.css">
scss
@use "pkg:@graupl/core/utilities/object.scss";

Sass variables ​

The following Sass variables can be used to customize the generation of the object utilities.

VariableDescriptionDefault Value
$selector-base"."The base selector for the utility
$selector-prefixThe selector prefix for all utility classes.""
$selector-suffixThe selector suffix for all utility classes.""
$selector-separatorThe selector separator for all utility classes."-"
$use-importantAppends !important to generated utility declarations.true
$generate-base-utilitiesGenerates the base utility classes.true
$screen-awareEnables screen-aware utility variants.false
$theme-awareEnables theme-aware utility variants.false
$scheme-awareEnables scheme-aware utility variants.false
$state-awareEnables state-aware utility variants.false
$container-awareEnables container-aware utility variants.false
$screen-aware-selector-prefixPrefix to the screen-aware portion of utility selectors.""
$screen-aware-selector-suffixSuffix to the screen-aware portion of utility selectors.""
$screen-aware-selector-separatorSeparator inserted for screen-aware utility selectors."\\:"
$theme-aware-selector-prefixPrefix to the theme-aware portion of utility selectors.""
$theme-aware-selector-suffixSuffix to the theme-aware portion of utility selectors."-theme"
$theme-aware-selector-separatorSeparator inserted for theme-aware utility selectors."\\:"
$scheme-aware-selector-prefixPrefix to the scheme-aware portion of utility selectors.""
$scheme-aware-selector-suffixSuffix to the scheme-aware portion of utility selectors."-mode"
$scheme-aware-selector-separatorSeparator inserted for scheme-aware utility selectors."\\:"
$state-aware-selector-prefixPrefix to the state-aware portion of utility selectors.""
$state-aware-selector-suffixSuffix to the state-aware portion of utility selectors.""
$state-aware-selector-separatorSeparator inserted for state-aware utility selectors."\\:"
$container-aware-selector-prefixPrefix to the container-aware portion of utility selectors."cq\\:"
$container-aware-selector-suffixSuffix to the container-aware portion of utility selectors.""
$container-aware-selector-separatorSeparator inserted for container-aware utility selectors."\\:"
$utility-propertiesMap of utility properties.()
$utility-valuesMap of utility values.()
$utility-mapMap of utility property/value pairs.()

Responsive Variants ​

No responsive classes are generated by default. See the Responsive Classes guide for configuration.