I have a single word that needs to be hyphenated, but the lang=en
hyphenate: auto
property does not work on capitalized words.
To address this, I utilized the slice function in JavaScript to split the word in half so that the second half, which requires hyphenation, is no longer considered capital.
However, this solution functions effectively on Chrome but encounters issues with Firefox.
Although German permits the hyphenation of uppercase letters, I prefer not to switch languages.
Here's a snippet of example code:
let word = 'Exceptional'
<div>
<span class='hyphenate'>
{word.slice(0,1)}
{word.slice(1)}
<span>
<div>
.hyphenate {
display: 'flex'
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
In this code snippet, if the div size is insufficient, 'Exceptional' will automatically be hyphenated in all browsers except for Firefox.