CSS özellikleri bir elementin arkaplanını belirlemenize imkan sağlar. Arkaplanlar renkler ya da resimler olabilir.
Arkaplan özellikleri şunlardır:
1. back-ground,
2. background-color,
3. background-image,
4. background-repeat,
5. back-ground-attachment,
6. background-position.
Şimdi bunları tek tek açıklayalım:
1. background
Değer: background-color, background-image, back ground-repeat, background-attachment, back-ground-position, inherit
Nelere uygulanır: Bütün unsurlara.
background özelliği kişisel arkaplan özelliklerini ayarlamak için pratik bir yoldur.
Örnek:
Kod: BODY { background: red }
P { background: url("bg.png") #cecece 50% repeat fixed }
2. background-color
Değer: color, transparent, inherit
Nelere uygulanır: Bütün unsurlara.
Örnek:
Kod: table { background-color: #cecece }
3. background-image
Değer: url, none, inherit
Nelere uygulanır: Bütün unsurlara.
Bir arkaplan resmi ayarladığınız zaman eğer resim mevcut değilse bir renk belirtmeniz gerekir.
Örnek:
Kod: .title { background-image: url("images/title.gif") }
div { background-image: none }
4. background-repeat
Değer: repeat, repeat-x, repeat-y, no-repeat, inherit
Nelere uygulanır: Bütün unsurlara.
Bu özellik arkaplan resminin x veya y pozisyonunda tekrarı istendiği zaman kullanılır.
Örnek:
Kod: .content {
background: white url("bg.gif");
background-repeat: repeat-x;
background-position: center;
}
5. background-attachment
Değer: scroll, fixed, inherit
Nelere uygulanır: Bütün unsurlara.
Örnek:
Kod: .content {
background: white url("bg.gif");
background-repeat: repeat-x;
background-attachment: fixed;
}
6. background-position
Değer: percentage, length, top center bottom left center right, inherit
Nelere uygulanır: block-level ve değiştirilen unsurlar.
Örnek:
Kod: BODY { background: url("logo.jpeg") right top } /* 100% 0% */ |