I\'m trying to justify the text within this p tag so that it perfectly fits the width of the p.
try this
for div
div {
text-align:justify;
text-justify: inter-word;
text-align-last:center;
/* for IE9 */
-ms-text-align-last:center;
}
Chrome doesn't support it but in Firefox and IE, you can use text-align-last: justify;
. For a cross-browser solution, we have to use what @onemanarmy posted ;)
In my case for < p > tag, works with easy way:
p {
text-align: justify;
text-justify: inter-word;
}
https://css-tricks.com/almanac/properties/t/text-justify/
If you wanted to justify four words in 487px
you could try using word-spacing
in your css
.
I used word-spacing:8em;
for bla bla bla bla
but you could adjust as necessary.
http://jsfiddle.net/5RpQr/1/