CSS Simplified

Share this post

This CSS property helps you display text better in narrow spaces

shrutibalasa.substack.com

This CSS property helps you display text better in narrow spaces

Shruti Balasa
Jan 25
Share this post

This CSS property helps you display text better in narrow spaces

shrutibalasa.substack.com

Ever been in a situation where you have to display some paragraphs in a narrow block or column? You must have noticed a lot of white space to the right if you have long words that go into the next line.

Did you know you can fix this and make it look a lot better with just one line of CSS? Yes, here’s the magic rule:

Thanks for reading CSS Simplified! Subscribe for free to receive new posts and support my work.

hyphens: auto

This will automatically add hyphens to split long words, and you will end up with lesser whitespace.

See the difference? On the right, the words “disapprovingly”, “inside“ and “infomed“ have been split into two lines using hyphens.

You may not always want to use this. Depends on the situation, but nice to know right?

Codepen link for reference

📘 Complete Guide to CSS Flex and Grid

If you loved this write-up and how it was explained, you’ll absolutely love my eBook CSS Flex and Grid. Check it out!

📨 Newsletter suggestion

I love Tailwind CSS. If you love it too, I highly recommend subscribing to this one 👇

Tailwind Weekly: Weekly newsletter about all things Tailwind CSS. New issue every Saturday.

Thanks for reading CSS Simplified! Subscribe for free to receive new posts and support my work.

Share this post

This CSS property helps you display text better in narrow spaces

shrutibalasa.substack.com
Comments
TopNewCommunity

No posts

Ready for more?

© 2023 Shruti Balasa
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing