Text-align: Justify remove too much spacing between words in CSS

nedash
 
on May 06, 2021 10:36 PM
5811 Views

hi

I used the below code for label to justify text

I want it justify texts but it doesn't many space between texts

.LblMusic {
    float:left;
    margin:13px 0 0 33.5px;
    width:372px;
    height:310px;
    text-align:justify;      
    font-size:24px;
    line-height:38px;          
}

problem is that it would justify texts but it put much spaces between texts please refer to below video:

https://gofile.io/d/8JBCyl

best regards

Neda

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on May 07, 2021 01:18 AM
on May 07, 2021 01:18 AM

Hi nedash,

Use word-break: break-all.

HTML

<span class="LblMusic">To format paragraphs I use text-align:justify, but I have one problem that there are big spaces between words.</span>
<style type="text/css">
    .LblMusic {
        float: left;
        margin: 13px 0 0 33.5px;
        width: 400px;
        height: 310px;
        text-align: justify;
        font-size: 24px;
        line-height: 38px;
        word-break: break-all;
    }
</style>

Demo