HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

background-size

Description

The background-size property for CSS specifies the size of the background images.

Syntax

CSS

background-size: value;

JS

object.style.backgroundSize = "value";

Values

<'background-size'> = <bg-size>#
<bg-size> = [ <length-percentage [0,∞]> | auto ]{1,2} | cover | contain
<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

auto

Automatically specified by the user agent.

cover

Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.

contain

Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.

Initial

auto

Examples

1 · auto

2 · contain

3 · cover

4 · length

5 · percentage

6 · JS