Saltar al contenido

Propiedad all de CSS

La propiedad all restablece todas las propiedades del elemento seleccionado, excepto unicode-bidi y direction, que controlan la dirección del texto.

Esta propiedad se considera una abreviatura de restablecimiento. A diferencia de las abreviaturas de múltiples valores como margin o background, no tiene una versión larga ni subpropiedades.

Valor inicialnormal
Se aplica aTodos los elementos.
HeredableNo.
AnimableNo.
VersiónCSS3
Sintaxis DOMobject.style.all = "inherit";

Sintaxis

Sintaxis de la propiedad all de CSS

css
all: initial | inherit | unset | revert | revert-layer;

Ejemplo de la propiedad all con el valor revert:

Ejemplo de la propiedad CSS all con el valor revert

html
<!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>

Resultado

Propiedad all de CSS

Ejemplo de la propiedad all con los valores inherit, initial y unset:

Ejemplo de la propiedad CSS all con los valores inherit, initial y unset

html
<!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>

Valores

ValorDescripción
initialEstablece la propiedad en su valor inicial.
inheritHereda la propiedad de su elemento padre.
unsetSe comporta como inherit para propiedades heredables y initial para las no heredables.
revertEspecifica un comportamiento que depende del origen de la hoja de estilos al que pertenece la declaración.
revert-layerRestablece la propiedad al valor establecido en la capa de cascada anterior.

Práctica

Según el sitio w3docs, ¿cuáles de las siguientes afirmaciones sobre CSS son verdaderas?

¿Te resulta útil?

Vista previa dual-run — compárala con las rutas Symfony en producción.