Stretch Texts across the entire width of a page

Donald Symmons 3,066 Reputation points
2025-12-07T07:51:07.4533333+00:00

How can I stretch texts to the entire width of the page? Just like in the image below

stretch

Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rin-L 10,740 Reputation points Microsoft External Staff Moderator
    2025-12-07T08:24:43.1333333+00:00

    Hi @Donald Symmons,

    Thank you for posting your question in the Microsoft Q&A forum! Could you share a bit more about your scenario? Are you trying to stretch text across the entire width for a webpage, or in an application like Word or Google Docs? 

    I also noticed your question is currently posted under Microsoft Teams | Development, which is typically focused on building custom apps, bots, or integrations for Teams. If your goal is related to web design or document formatting, we might need to adjust the scope so you get the most accurate guidance.

    Looking forward to your reply!


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  


  2. cheong00 3,486 Reputation points Volunteer Moderator
    2025-12-13T20:58:08.1833333+00:00

    Unfortunately the CSS property "text-align: justify; text-justify : inter-character" combo cannot automatically calculate the even spacing for you if the contain width exceed a certain reasonable size for the text (in the example case it's about 115px).

    You need to use javascript to calculate how many characters your text to display has, then set letter-spacing to the calc((100vw / (<number of character - 1)) - 1ch), where "ch" is the width unit for the width of 1 character.

    <div style="width: 100vw; letter-spacing: calc((100vw / 17) - 1ch)">Here is some text</div>
    
    

    You may want to adjust your result to 1.1ch or something like that if your text contains lots of wider character like "W" or reduce it if it contains lots of narrower one like "i" though.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.