Ren
Ren

Reputation: 1051

How can the string be hyphened in a table when it is long and can possibly contain dashes

I am trying to fit a long string which can optionally contain dash(-). When it contain dashes it should hyphen at these dashes. I tried word-break: break all; but it does not break it at hyphens. Is there any way to achieve my goal in a pure css?

An example: https://jsfiddle.net/5gyzv7cn/1/

Upvotes: 2

Views: 35

Answers (1)

Kareem Dabbeet
Kareem Dabbeet

Reputation: 3994

You should use break-word, this will break the string at dashes if exists.

I've added:

td { 
word-break: break-word;
}

See JSfiddle: https://jsfiddle.net/hatufvy1/11/

Upvotes: 1

Related Questions