I want a text to be justified inside a div. When the line breaks, I would love to have the second line (shorter) to be centered. Now the first line is justified, the second is aligned left.
Any ideas?
CSS:
.credits
{
opacity:.2;
text-align:justify;
font-size:18px;
line-height:21px;
}
If your second line is the last line, then you can use text-align-last
:
.credits {
opacity: .2;
text-align: justify;
text-align-last: center;
-moz-text-align-last: center; /* Firefox needs a prefix, according to the docs */
font-size: 18px;
line-height: 21px;
}
Warning: This is neither supported in Safari (mobile) nor Opera.