:root CSS sözde-sınıfı dökümanda bulunan kök elemanı yerine geçer (yani onu temel alır). Örneğin HTML'de :root dökümanı oluşturan <html> öğesini temsil eder ve html seçicisi ile aynıdır, ancak önceliği daha yüksektir.
/* Dökümandaki kök elemanı seçer:
Bu HTML'de <html> oluyor. */
:root {
background: royalblue;
}
Sözdizimi
:root
Örnek
:root global CSS değişkenleri tanımlarken kullanışlı olabilir:
:root {
--ana-renk: green;
--paragraf-boslugu: 5px 0;
}
Tanımlamalar
| Tanımlama | Durum | Açıklama |
|---|---|---|
| Selectors Level 4 The definition of ':root' in that specification. |
Working Draft | Değişiklik yok. |
| Selectors Level 3 The definition of ':root' in that specification. |
Recommendation | Başlangıç tanımı. |
Tarayıcı Uyumluluğu
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
:root | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 9 | Opera Full support 9.5 | Safari Full support 1 | WebView Android Full support 37 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android ? | Safari iOS Full support 1 | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
Document Tags and Contributors
Tags:
Contributors to this page:
mdnwebdocs-bot,
ahmetkaba
Last updated by:
mdnwebdocs-bot,