CSS text-align-last Propiedad
Ejemplo
Alinee la última línea de texto en tres elementos <div>:
div.a
{
text-align: justify; /* For Edge */
text-align-last: right;
}
div.b
{
text-align: justify; /* For Edge */
text-align-last: center;
}
div.c
{
text-align: justify; /* For Edge */
text-align-last: justify;
}
Más ejemplos de "Pruébelo usted mismo" a continuación.
Definición y uso
La text-align-last
propiedad especifica cómo alinear la última línea de un texto.
Observe que la text-align-last
propiedad establece la alineación de todas las últimas líneas dentro del elemento seleccionado. Entonces, si tiene un <div> con tres párrafos, text-align-last
se aplicará a la última línea de CADA uno de los párrafos. Para usar text-align-last
solo en el último párrafo del contenedor, puede usar :last child, vea el ejemplo a continuación.
Nota: En Edge anterior a 79, la text-align-last
propiedad solo funciona en texto que tiene "text-align:Justify".
Valor por defecto: | auto |
---|---|
Heredado: | sí |
Animable: | No. Leer sobre animable |
Versión: | CSS3 |
Sintaxis de JavaScript: | objeto .style.textAlignLast="derecho" |
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con la propiedad.
Los números seguidos de -moz- especifican la primera versión que funcionó con un prefijo.
Property | |||||
---|---|---|---|---|---|
text-align-last | 47.0 | 5.5* | 49.0 12.0 -moz- |
Not supported | 34.0 |
*En Internet Explorer 11 (y versiones anteriores), los valores de "inicio" y "finalización" no son compatibles.
Sintaxis CSS
text-align-last: auto|left|right|center|justify|start|end|initial|inherit;
Valores de propiedad
Value | Description | Play it |
---|---|---|
auto | Default value. The last line is justified and aligned left | |
left | The last line is aligned to the left | |
right | The last line is aligned to the right | |
center | The last line is center-aligned | |
justify | The last line is justified as the rest of the lines | |
start | The last line is aligned at the beginning of the line (left if the text-direction is left-to-right, and right is the text-direction is right-to-left) | |
end | The last line is aligned at the end of the line (right if the text-direction is left-to-right, and left is the text-direction is right-to-left) | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Más ejemplos
Ejemplo
Use text-align-last solo en la última línea del contenedor:
div.b p:last-child {
text-align-last: center;
}
páginas relacionadas
Tutorial CSS: Texto CSS
Referencia HTML DOM: propiedad textAlignLast