Example
နောက်ခံပုံရဲ့အရွယ်အစားကို "auto" နဲ့ pixels တွေသတ်မှတ်နိုင်ပါသည်။
- #example1{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: auto;- }
- #example2{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: 300px 100px;- }
Definition and Usage
Background-size property ကနောက်ခံပုံတွေရဲ့အရွယ်အစားကိုသတ်မှတ်ပါတယ်။ သင်သုံးနိုင်သောကွဲပြားခြားနားသော syntaxes ၄ ခုရှိသည်။ ("auto", "cover" နှင့် "contain")၊ one-value syntax (ပုံ၏အကျယ်ကိုသတ်မှတ်သည် (အမြင့်သည် "auto")၊ two-value syntax (ပထမတန်ဖိုး : ပုံအကျယ်၊ ဒုတိယတန်ဖိုး : အမြင့်)သတ်မှတ်နိုင်သည်။
| Default value: | auto | |
| Inherited: | no | |
| Animatable: | yes | |
| Version: | CSS3 | |
| JavaScript syntax: | object.style.backgroundSize="60px 120px" | |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -webkit-, -moz-, or -o- specify the first version that worked with a prefix.
| Property | |||||
|---|---|---|---|---|---|
| background-size | 4.0 1.0 -webkit- |
9.0 | 4.0 3.6 -moz- |
4.1 3.0 -webkit- |
10.5 10.0 -o- |
CSS Syntax
Property Values
| Value | Description | |
|---|---|---|
| auto | Default value. The background image is displayed in its original size | |
| length | Sets the width and height of the background image. The first value sets the width, the second value sets the height. If only one value is given, the second is set to "auto". | |
| percentage | Sets the width and height of the background image in percent of the parent element. The first value sets the width, the second value sets the height. If only one value is given, the second is set to "auto" | |
| cover | Resize the background image to cover the entire container, even if it has to stretch the image or cut a little bit off one of the edges | |
| contain | Resize the background image to make sure the image is fully visible | |
| initial | Sets this property to its default value. | |
| inherit | Inherits this property from its parent element. | |
More Examples
Example
နောက်ခံပုံ၏ရာခိုင်နှုန်းကိုသတ်မှတ်ပါ။
- #example1{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: 100% 100%;- }
- #example2{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: 75% 50%;- }
Example
နောက်ခံပုံရဲ့အရွယ်အစားကို "cover" နဲ့သတ်မှတ်ပါ။
- #example1{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: cover;- }
Example
နောက်ခံပုံရဲ့အရွယ်အစားကို "contain" နဲ့သတ်မှတ်ပါ။
- #example1{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: contain;- }
Example
နောက်ခံပုံရဲ့အရွယ်အစားကို "cover" နဲ့သတ်မှတ်ပါ။
- #example1{
background-img: url("mountain.jpg");background-repeat: on-repeat;background-size: contain,cover;- }
Example
- #example1{
background-img: url("photographer.jpg"); /* The image used */background-color: #cccccc; /* Used if the image is unavailable */hight: 500px; /* You must set a specified height */baackground-position: center; /* Center the image */baackground-repeat: no-repeat; /* Do not repeat the image */background-size: cover; /* Resize the background image to cover the entire container */- }
No comments:
Post a Comment