CSS text-align-last Proprietà
Esempio
Allinea l'ultima riga di testo in tre elementi <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;
}
Altri esempi "Provalo da solo" di seguito.
Definizione e utilizzo
La text-align-last
proprietà specifica come allineare l'ultima riga di un testo.
Si noti che la text-align-last
proprietà imposta l'allineamento per tutte le ultime righe all'interno dell'elemento selezionato. Quindi, se hai un <div> con tre paragrafi, text-align-last
si applicherà all'ultima riga di CIASCUNO dei paragrafi. Per utilizzare text-align-last
solo l'ultimo paragrafo nel contenitore, puoi usare :last child, vedi esempio sotto.
Nota: in Edge precedente 79, la text-align-last
proprietà funziona solo su testo che ha "text-align: justify".
Valore di default: | auto |
---|---|
Ereditato: | sì |
Animabile: | no. Leggi su animabile |
Versione: | CSS3 |
sintassi JavaScript: | oggetto .style.textAlignLast="right" |
Supporto browser
I numeri nella tabella specificano la prima versione del browser che supporta completamente la proprietà.
I numeri seguiti da -moz- specificano la prima versione che ha funzionato con un prefisso.
Property | |||||
---|---|---|---|---|---|
text-align-last | 47.0 | 5.5* | 49.0 12.0 -moz- |
Not supported | 34.0 |
*In Internet Explorer 11 (e versioni precedenti), i valori "inizio" e "fine" non sono supportati.
Sintassi CSS
text-align-last: auto|left|right|center|justify|start|end|initial|inherit;
Valori di proprietà
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 |
Altri esempi
Esempio
Usa text-align-last solo sull'ultima riga nel contenitore:
div.b p:last-child {
text-align-last: center;
}
Pagine correlate
Tutorial CSS: testo CSS
Riferimento HTML DOM: proprietà textAlignLast