CSS text align justify big spaces
if you’re seeing big spaces when using text-align: justify in CSS, this is most likely due to the fact that the text is being spread out to fill the available space, which can cause irregular spacing between words.
One solution to this problem is to adjust the spacing between words. You can do this using the CSS property “word-spacing”. For example, you can add the following to your CSS code:
p {
text-align: justify;
word-spacing: -0.2em; /* Adjust the value to your liking */
}
This will reduce the spacing between words, resulting in a more even distribution of text. You can adjust the value of word-spacing until you achieve the desired result.
Another solution is to use hyphenation. This can help to reduce the irregular spacing caused by text-align: justify. You can enable hyphenation by adding the following to your CSS code:
p {
text-align: justify;
hyphens: auto;
}
This will automatically hyphenate words when necessary to create a more even distribution of text. However, note that not all browsers support this property, so it may not work in all cases.
Finally, it’s worth noting that text-align: justify can sometimes create large spaces when there is not enough text to fill the available space. In this case, the best solution is often to simply reduce the width of the text container.