How to force a line break in a long word in a div with CSS?

Spread the love

Sometimes, we want to force a line break in a long word in a div with CSS.

In this article, we’ll look at how to force a line break in a long word in a div with CSS.

How to force a line break in a long word in a div with CSS?

To force a line break in a long word in a div with CSS, we can use the word-break property.

For instance, we write

.your_element {
  word-break: break-all;
}

to add the word-break: break-all style to all elements with class your_element wrap long words into separate lines.

Conclusion

To force a line break in a long word in a div with CSS, we can use the word-break property.

Leave a Reply

Your email address will not be published.