background

fun StyleScope.background(background: Background)(source)
fun StyleScope.background(vararg backgrounds: Background.Repeatable)(source)


fun StyleScope.background(color: CSSColorValue?, vararg backgrounds: Background.Repeatable)(source)

A Kotlin-idiomatic API to configure the background CSS property.

Background layers are specified in bottom-to-top order. Note that this is the opposite of how CSS does it, which for this property expects a top-to-bottom order. However, we decided to deviate from the standard here for the following reasons:

  • Everything else in HTML uses a bottom-to-top order (e.g. declaring elements on a page).

  • This method accepts a color parameter first (in front of the vararg background layers), which renders on the bottom of everything else. This sets the expectation that "bottom" values come first.

See also