CSS Arkaplan Kısayolu
CSS arka planı - Steno özelliği
Kodu kısaltmak için tüm arka plan özelliklerini tek bir özellikte belirtmek de mümkündür. Buna stenografi özelliği denir.
Yazmak yerine:
body {
background-color: #ffffff;
background-image:
url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
}
Shorthand özelliğini kullanabilirsiniz background
:
Örnek
Tek bir bildirimde arka plan özelliklerini ayarlamak için stenografi özelliğini kullanın:
body {
background: #ffffff url("img_tree.png") no-repeat right top;
}
Steno özelliğini kullanırken, özellik değerlerinin sırası şöyledir:
background-color
background-image
background-repeat
background-attachment
background-position
Diğerleri bu sırada olduğu sürece, özellik değerlerinden birinin eksik olması önemli değildir. Bir değeri olmadığı için yukarıdaki örneklerde background-attachment özelliğini kullanmadığımızı unutmayın.
Tüm CSS Arka Plan Özellikleri
Property | Description |
---|---|
background | Sets all the background properties in one declaration |
background-attachment | Sets whether a background image is fixed or scrolls with the rest of the page |
background-clip | Specifies the painting area of the background |
background-color | Sets the background color of an element |
background-image | Sets the background image for an element |
background-origin | Specifies where the background image(s) is/are positioned |
background-position | Sets the starting position of a background image |
background-repeat | Sets how a background image will be repeated |
background-size | Specifies the size of the background image(s) |