Monday, January 17, 2022
HomeWindowsbackground-size - CSS: Cascading Style Sheets

background-size – CSS: Cascading Style Sheets

track record-dimension

The track record-dimension CSS home sets the dimension of the element’s track record graphic. The graphic can be still left to its pure dimension, stretched, or constrained to healthy the obtainable place.

Areas not coated by a track record graphic are crammed with the track record-colour home, and the track record colour will be noticeable guiding track record illustrations or photos that have transparency/translucency.

 

track record-dimension

:

go over

track record-dimension

:

have

track record-dimension

:

fifty%

track record-dimension

:

three.2em

track record-dimension

:

12px

track record-dimension

:

car

track record-dimension

:

fifty% car

track record-dimension

:

3em twenty five%

track record-dimension

:

car 6px

track record-dimension

:

car car

track record-dimension

:

car

,

car

track record-dimension

:

fifty%

,

twenty five%

,

twenty five%

track record-dimension

:

6px

,

car

,

have

track record-dimension

:

inherit

track record-dimension

:

first

track record-dimension

:

revert

track record-dimension

:

unset

The track record-dimension home is specified in just one of the adhering to strategies:

  • Applying the search phrase values have or go over.
  • Applying a width price only, in which situation the peak defaults to car.
  • Applying the two a width and a peak price, in which situation the to start with sets the width and the next sets the peak. Every single price can be a <length>, a <percentage>, or car.

To specify the dimension of several track record illustrations or photos, different the price for every single just one with a comma.

have

Scales the graphic as substantial as doable in its container devoid of cropping or stretching the graphic. If the container is bigger than the graphic, this will consequence in graphic tiling, until the track record-repeat home is established to no-repeat.

go over

Scales the graphic as substantial as doable to fill the container, stretching the graphic if required. If the proportions of the graphic vary from the ingredient, it is cropped both vertically or horizontally so that no vacant place continues to be.

car

Scales the track record graphic in the corresponding course these types of that its intrinsic proportions are managed.

<length>

Stretches the graphic in the corresponding dimension to the specified duration. Damaging values are not authorized.

<percentage>

Stretches the graphic in the corresponding dimension to the specified proportion of the track record positioning space. The track record positioning space is decided by the price of track record-origin (by default, the padding box). Even so, if the background’s track record-attachment price is set, the positioning space is rather the whole viewport. Damaging values are not authorized.

See also  KMSPico Activator Download Final 11 [2021] Windows 7
See also  Which Edition of Windows 7 Should You Buy?

The computation of values is dependent on the image’s intrinsic proportions (width and peak) and intrinsic proportions (width-to-peak ratio). These characteristics are as follows:

  • A bitmap graphic (these types of as JPG) usually has intrinsic proportions and proportions.
  • A vector graphic (these types of as SVG) does not always have intrinsic proportions. If it has the two horizontal and vertical intrinsic proportions, it also has intrinsic proportions. If it has no proportions or only just one dimension, it may well or may well not have proportions.
  • CSS <gradient>s have no intrinsic proportions or intrinsic proportions.
  • Track record illustrations or photos produced with the ingredient() purpose use the intrinsic proportions and proportions of the making ingredient.

Be aware: In Gecko, track record illustrations or photos produced making use of the ingredient() purpose are at the moment dealt with as illustrations or photos with the proportions of the ingredient, or of the track record positioning space if the ingredient is SVG, with the corresponding intrinsic proportion. This is non-common conduct.

Based mostly on the intrinsic proportions and proportions, the rendered dimension of the track record graphic is computed as follows:

  • If the two parts of track record-dimension are specified and are not car: The track record graphic is rendered at the specified dimension.
  • If the track record-dimension is have or go over: Even though preserving its intrinsic proportions, the graphic is rendered at the biggest dimension contained in, or masking, the track record positioning space. If the graphic has no intrinsic proportions, then it is really rendered at the dimension of the track record positioning space.
  • If the track record-dimension is car or car car:
    • If the graphic has the two horizontal and vertical intrinsic proportions, it is really rendered at that dimension.
    • If the graphic has no intrinsic proportions and has no intrinsic proportions, it is really rendered at the dimension of the track record positioning space.
    • If the graphic has no intrinsic proportions but has intrinsic proportions, it is really rendered as if have experienced been specified rather.
    • If the graphic has only just one intrinsic dimension and has intrinsic proportions, it is really rendered at the dimension corresponding to that just one dimension. The other dimension is computed making use of the specified dimension and the intrinsic proportions.
    • If the graphic has only just one intrinsic dimension but has no intrinsic proportions, it is really rendered making use of the specified dimension and the other dimension of the track record positioning space.

    Be aware: SVG illustrations or photos have a preserveAspectRatio attribute that defaults to the equal of have an specific track record-dimension results in preserveAspectRatio to be disregarded.

  • If the track record-dimension has just one car element and just one non-car element:
    • If the graphic has intrinsic proportions, it is really stretched to the specified dimension. The unspecified dimension is computed making use of the specified dimension and the intrinsic proportions.
    • If the graphic has no intrinsic proportions, it is really stretched to the specified dimension. The unspecified dimension is computed making use of the image’s corresponding intrinsic dimension, if there is just one. If there is no these types of intrinsic dimension, it gets to be the corresponding dimension of the track record positioning space.
See also  formatowanie trybie awaryjnym
See also  formatowanie trybie awaryjnym

Be aware: Track record sizing for vector illustrations or photos that deficiency intrinsic proportions or proportions is not still entirely carried out in all browsers. Be very careful about relying on the conduct explained over, and exam in several browsers to be confident the final results are suitable.

If you use a <gradient> as the track record and specify a track record-dimension to go with it, it is really greatest not to specify a dimension that makes use of a solitary car element, or is specified making use of only a width price (for case in point, track record-dimension: fifty%). Rendering of <gradient>s in these types of scenarios transformed in Firefox eight, and at current is normally inconsistent throughout browsers, which do not all employ rendering in complete accordance with the CSS3 track record-dimension specification and with the CSS3 Impression Values gradient specification.

.gradient-case in point

{

width

:

50px

peak

:

100px

track record-graphic

:

linear-gradient

(

blue

,

purple

)

track record-dimension

:

25px

track record-dimension

:

fifty%

track record-dimension

:

car 50px

track record-dimension

:

car fifty%

track record-dimension

:

25px 50px

track record-dimension

:

fifty% fifty%

}

Be aware that it is really notably not suggested to use a pixel dimension and an car dimension with a <gradient>, since it is really unachievable to replicate rendering in variations of Firefox prior to eight, and in browsers not utilizing Firefox 8’s rendering, devoid of being aware of the correct dimension of the ingredient whose track record is remaining specified.

Original pricecar carApplies toall features. It also applies to ::to start with-letter and ::to start with-line.InheritednoPercentagesrelative to the track record positioning spaceComputed priceas specified, but with relative lengths transformed into complete lengthsAnimation typerepeatable checklist of uncomplicated checklist of duration, proportion, or calc

See also  WORKING Windows 7 Home Premium Product Key
See also  KMSPico Activator Download Final 11 [2021] Windows 7

Let us take into consideration a substantial graphic, a 2982×2808 Firefox brand graphic. We want to tile 4 copies of this graphic into a 300×300-pixel ingredient. To do this, we can use a set track record-dimension price of one hundred fifty pixels.

HTML

<

div

course

=

"

tiledBackground

"

>

</

div

>

CSS

.tiledBackground

{

track record-graphic

:

url

(

https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png

)

track record-dimension

:

150px

width

:

300px

peak

:

300px

border

:

2px sound

colour

:

pink

}

Final result

See Scaling track record illustrations or photos for far more illustrations.

BCD tables only load in the browser

Xem thêm bài viết thuộc chuyên mục: Windows
RELATED ARTICLES

Most Popular

Recent Comments