monks/background_size

The background-size CSS property sets the size of the element’s background image. The image can be left to its natural size, stretched, or constrained to fit the available space.

Spaces not covered by a background image are filled with the {{cssxref(“background-color”)}} property, and the background color will be visible behind background images that have transparency/translucency.

Values

pub const auto_: #(String, String)
  • : Scales the background image in the corresponding direction such that its intrinsic proportions are maintained.
pub const contain: #(String, String)
  • : Scales the image as large as possible within its container without cropping or stretching the image. If the container is larger than the image, this will result in image tiling, unless the {{cssxref(“background-repeat”)}} property is set to no-repeat.
pub const cover: #(String, String)
  • : Scales the image (while preserving its ratio) to the smallest possible size to fill the container (that is: both its height and width completely cover the container), leaving no empty space. If the proportions of the background differ from the element, the image is cropped either vertically or horizontally.
pub const inherit: #(String, String)
pub const initial: #(String, String)
pub fn length(value: monks_of_style.Length) -> #(String, String)

length value of background-size

pub fn raw(value: String) -> #(String, String)

Enter a raw string value for background-size

pub const revert: #(String, String)
pub const revert_layer: #(String, String)
pub const unset: #(String, String)
pub fn var(variable: String) -> #(String, String)

Enter a variable name to be used for background-size. It will be wrapped in var() and have -- prepended.

Search Document