W3docs

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 inizialenormal
Si applica aTutti gli elementi.
EreditataNo.
AnimabileNo.
VersioneCSS3
Sintassi DOMobject.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

Proprietà CSS all

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

ValoreDescrizione
initialImposta la proprietà al suo valore iniziale.
inheritEredita la proprietà dall'elemento genitore.
unsetAgisce come inherit per le proprietà ereditabili e come initial per quelle non ereditabili.
revertSpecifica un comportamento che dipende dall'origine del foglio di stile a cui appartiene la dichiarazione.
revert-layerRiporta 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?
According to the site w3docs, which of the following statements about CSS are true?
Was this page helpful?