top
Expand Minimize
This topic has not yet been rated - Rate this topic

backgroundSize property

Specifies the size of the background images.

CSS Backgrounds and Borders Module Level 3, Section 3.9Internet Explorer 9

Syntax

Integer value = object.put_backgroundSize( v);Integer value = object.get_backgroundSize(* sSize);

Property values

Type: BSTR

auto (auto)

Default. See Remarks.

contain (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.

cover (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.

length (length)

A floating-point number, followed by a supported length unit.

percentage (percentage)

An integer, followed by a percent (%). A percentage value is relative to the background positioning area.

String format

auto | contain | cover | <percentage> | <length>

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Valueauto

Standards information

Remarks

An "auto" value for one dimension is resolved by using the image's intrinsic ratio and the size of the other dimension. If either of these values is not available, the image's intrinsic size is used. If the image's intrinsic size is not available, it is assigned the value of 100%. If both values are "auto", use the intrinsic width, height, or both, of the image. If the image has neither an intrinsic width nor an intrinsic height, its size is determined as for "contain".

Negative values are not allowed.

In Windows Internet Explorer 9, the background of a box can have multiple layers. The number of layers is determined by the number of comma-separated values in the IHTMLCSSStyleDeclaration::backgroundImage property. Each of the images is sized, positioned, and tiled according to the corresponding value in the other background properties (IHTMLCSSStyleDeclaration::backgroundAttachment, IHTMLCSSStyleDeclaration::backgroundClip, IHTMLCSSStyleDeclaration::backgroundOrigin, IHTMLCSSStyleDeclaration::backgroundPosition, IHTMLCSSStyleDeclaration::backgroundRepeat, and IHTMLCSSStyleDeclaration::backgroundSize). The first image in the list is the layer closest to the user, the next one is painted behind the first, and so on.

Requirements

Minimum supported client

Windows Vista with SP1, Windows 7

Minimum supported server

Windows Server 2008 R2

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

Reference
IHTMLCSSStyleDeclaration::backgroundColor
IHTMLCSSStyleDeclaration::backgroundImage
IHTMLCSSStyleDeclaration::backgroundRepeat
IHTMLCSSStyleDeclaration::backgroundAttachment
IHTMLCSSStyleDeclaration::backgroundPosition
IHTMLCSSStyleDeclaration::backgroundClip
IHTMLCSSStyleDeclaration::backgroundOrigin
IHTMLCSSStyleDeclaration::background

 

 

Build date: 11/12/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.