Proprietà CSS all
all è una proprietà CSS che reimposta tutte le proprietà ai loro valori initial e inherit. Guarda gli esempi.
La proprietà all reimposta tutte le proprietà dell'elemento selezionato, ad eccezione di unicode-bidi e direction, che controllano la direzione del testo.
Questa proprietà è considerata una shorthand di reset. A differenza delle shorthand a più valori come margin o background, non ha una versione longhand né sotto-proprietà.
| Valore iniziale | normal |
|---|---|
| Si applica a | Tutti gli elementi. |
| Ereditata | No. |
| Animabile | No. |
| Versione | CSS3 |
| Sintassi DOM | object.style.all = "inherit"; |
Sintassi
Sintassi della proprietà CSS all
all: initial | inherit | unset | revert | revert-layer;Esempio della proprietà all con il valore revert:
Esempio della proprietà CSS all con il valore revert
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
.example {
background-color: #8ebf42;
color: #666;
all: revert;
}
</style>
</head>
<body>
<h2>All property example</h2>
<p>Here the all: revert; is set.</p>
<div class="example"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
</body>
</html>Risultato

Esempio della proprietà all con i valori inherit, initial e unset:
Esempio della proprietà CSS all con i valori inherit, initial e unset
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
body {
font-size: 15px;
color: #1c87c9;
}
.example1 {
background-color: #8ebf42;
color: #666;
}
.example2 {
background-color: #8ebf42;
color: #666;
all: inherit;
}
.example3 {
background-color: #8ebf42;
color: #666;
all: initial;
}
.example4 {
background-color: #8ebf42;
color: #666;
all: unset;
}
</style>
</head>
<body>
<h2>All property example</h2>
<hr />
<p>No all property:</p>
<div class="example1"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
<hr />
<p>all: inherit:</p>
<div class="example2"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
<hr />
<p>all: initial:</p>
<div class="example3"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
<hr />
<p>all: unset:</p>
<div class="example4"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
<hr />
</body>
</html>Valori
| Valore | Descrizione |
|---|---|
| initial | Imposta la proprietà al suo valore iniziale. |
| inherit | Eredita la proprietà dall'elemento genitore. |
| unset | Agisce come inherit per le proprietà ereditabili e come initial per quelle non ereditabili. |
| revert | Specifica un comportamento che dipende dall'origine del foglio di stile a cui appartiene la dichiarazione. |
| revert-layer | Riporta la proprietà al valore impostato nel cascade layer precedente. |
Pratica
Pratica
According to the site w3docs, which of the following statements about CSS are true?
Was this page helpful?