Choose Insert > Special Characters > Hyphen & Dash > Soft Hyphen from the menu bar.
In Windows, use ALT + 0151. To use an em dash on a web page, create it in HTML with "—" or "—." You can also use the Unicode numeric entity of U+2014.
We can use ­ . It is a soft hyphen in HTML. It means that it will add a - if the word is too long. Else it will just render the word as is.
Unfortunately, ­
's support is so inconsistent between browsers that it can't really be used.
QuirksMode is right -- there's no good way to use soft hyphens in HTML right now. See what you can do to go without them.
2013 edit: According to QuirksMode, ­
now works/is supported on all major browsers.
They all perform pretty well, ­
edges it as Google can still index of words containing it.
­
and ­
both display as expected in major browsers (even old IE!). <wbr>
isn't supported in recent versions of IE (10 or 11) and doesn't work properly in Edge.­
and ­
for Chrome and Firefox on Mac, on Windows (10), it keeps the characters and pastes hard hyphens into Notepad and invisible soft hyphens into applications that support them. IE (win7) always pastes with hyphens, even in IE10, and Safari (Mac) copies in a way which pastes as hyphens in some applications (e.g. MS Word), but not others­
and ­
on all browsers except IE which only matches exact copied-and-pasted matches (even up to IE11)­
with words typed normally. As of 2017 it appears to no longer match words containing ­
. Yandex appers to be the same. Bing and Baidu seem to not match either.For up-to-date live testing, here are some examples of unique words with soft hyphens.
­
- confumbabbl­ication­ism
- confumbabblicationism
<wbr>
- donfounbabbl<wbr>ication<wbr>ism
. This site removes <wbr/>
from output. Here's a jsbin.com snippet for testing.
­
- eonfulbabbl­ication­ism
- eonfulbabblicationism
Here they are with no shy hyphens (this is for copying and pasting into find-on-page testing; written in a way which won't break the search engine tests):
ZZZconfumbabblicationismZZZdonfounbabblicationismZZZeonfulbabblicationismZZZ
Success: displaying as a normal word, except where it should break, when it breaks and hyphenates in the specified place.
Failure: displaying unusually, or failing to break in the intended place.
­
success, <wbr>
success, ­
success­
success, <wbr>
success, ­
success­
success, <wbr>
not tested yet, ­
success­
success, <wbr>
fail (break but no hyphen), ­
success­
success, <wbr>
fail (no break), ­
success­
success, <wbr>
fail (no break), ­
successword-wrap
. Sometimes, they seem to all work. Not yet found any clear pattern as to why.­
success, <wbr>
success, ­
successSuccess: copying and pasting the whole word, unhyphenated. (tested on Mac pasting into browser search, MS Word 2011, and Sublime Text)
Failure: pasting with a hyphen, space, line break, or with junk characters.
­
success, <wbr>
success, ­
success­
success, <wbr>
success, ­
success­
fail into MS Word (pastes all as hyphens), success in other applications <wbr>
fail, ­
fail into MS Word (pastes all as hyphens), success in other applications­
fail pastes all as hyphens, <wbr>
fail, ­
fail pastes all as hyphens­
fail pastes all as hyphens, <wbr>
fail, ­
fail pastes all as hyphens­
fail pastes all as hyphens, <wbr>
fail, ­
fail pastes all as hyphensUpdated in November 2017. <wbr>
not tested because StackOverflow's CMS stripped it out.
Success: searches on the whole, non-hyphenated word find this page.
Failure: search engines only find this page on searches for the broken segments of the words, or a word with hyphens.
­
fails, ­
succeeds­
fails, ­
fails­
fails, ­
fails (can match fragments within longer strings but not the words on their own containing a ­
or ­
)­
fails, ­
succeeds (though it's possible it's matching a string fragment like Baidu, not 100% sure)Success and failure as search engine matching.
­
success, <wbr>
success, ­
success­
success, <wbr>
success, ­
success­
success, <wbr>
success, ­
success­
fail only matches when both contain shy hyphens, <wbr>
success, ­
fail only matches when both contain shy hyphens­
fail only matches when both contain shy hyphens, <wbr>
success, ­
fail only matches when both contain shy hyphens­
fail only matches when both contain shy hyphens, <wbr>
success, ­
fail only matches when both contain shy hyphensThere is an ongoing effort to standardize hyphenation in CSS3.
Some modern browsers, notably Safari and Firefox, already support this. Here is a good and up to date reference on browser support.
Once the CSS hyphenation gets implemented universally, that would be the best solution. In the meantime, I can recommend Hyphenator - a JS script that figures out how to hyphenate your text in the way most appropriate for a particular browser.
Hyphenator:
­
on most other browsers,I've used it and it works great!
I use ­
, inserted manually where necessary.
I always find it a pity that people don’t use techniques because there is some—maybe old or strange—browser around which doesn’t handle them the way they were specified. I found that ­
is working properly in both recent Internet Explorer and Firefox browsers, that should be enough. You may include a browser check telling people to use something mature or continue at their own risk if they come around with some strange browser.
Syllabification isn’t that easy and I cannot recommend leaving it to some Javascript. It’s a language specific topic and may need to be carefully revised by the deskman if you don’t want it to turn your text irritating. Some languages, such as German, form compound words and are likely to lead to decomposition problems. E.g. Spargelder
(germ. saved money, pl.) may, by syllabification rules, be wrapped in two places (Spar-gel-der
). However, wrapping it in the second position, turns the first part to show up as Spargel-
(germ. asparagus), activating a completely misleading concept in the head of the reader and therefore shoud be avoided.
And what about the string Wachstube
? It could either mean ‘guardroom’ (Wach-stu-be
) or ‘tube of wax’ (Wachs-tu-be
). You may probably find other examples in other languages as well. You should aim to provide an environment in which the deskman can be supported in creating a well-syllabified text, proof-reading every critical word.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With