Saltar al contenido

Propiedad CSS text-justify

La propiedad text-justify define el comportamiento del espaciado entre palabras o caracteres.

La propiedad text-justify es una de las propiedades de CSS3.

La propiedad text-justify selecciona el método de justificación del texto cuando text-align se establece en "justify".

Valor inicialauto
Se aplica aElementos de nivel de bloque.
HeredableNo.
AnimableNo.
VersiónCSS3
Sintaxis DOMobject.style.textJustify = "inter-character";

Sintaxis

Valores de CSS text-justify

css
text-justify: auto | inter-word | inter-character | none | initial | inherit;

Ejemplo de la propiedad text-justify:

Ejemplo de código CSS text-justify

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-align: justify;
        text-justify: inter-word;
      }
    </style>
  </head>
  <body>
    <h2>Text-justify property example</h2>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
  </body>
</html>

Resultado

Valor inter-word de CSS text-justify

En el siguiente ejemplo, redimensione el navegador para ver cómo funciona "justify":

Ejemplo de la propiedad text-justify con el valor "inter-character":

Ejemplo de CSS text-justify con valor inter-character

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-align: justify;
        text-justify: inter-character;
      }
    </style>
  </head>
  <body>
    <h2>Text-justify property example</h2>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
  </body>
</html>

Nota: El soporte del navegador para text-justify es limitado. El valor inter-character no es compatible con la mayoría de los navegadores modernos.

Valores

ValorDescripciónPruébalo
autoEl algoritmo de justificación está definido. Se permite que el navegador determine si inter-word o inter-character es mejor para la justificación. Este es el valor predeterminado de esta propiedad.Pruébalo »
inter-wordEl navegador aumenta el espacio entre palabras. Esto es típico de los idiomas con límites de palabras claros.Pruébalo »
inter-characterEl navegador aumenta el espacio entre caracteres durante la justificación.Pruébalo »
noneLa justificación está desactivada.Pruébalo »
initialHace que la propiedad use su valor predeterminado.Pruébalo »
inheritHereda la propiedad de su elemento padre.

Práctica

¿Cuáles son los diferentes valores de la propiedad 'text-justify' en CSS y qué significan?

¿Te resulta útil?

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