Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-breaking dash html [duplicate]

Tags:

html

css

I know that there is a non breaking whitespace -  . Is there a non-breaking dash (-) I can use so that my word doesn't wrap (break) at that location. Also can someone point me to a list with characters that are considered with priority when breaking a sentence ( like a whitespace). Thanks in advance :)

like image 671
user3719857 Avatar asked Jan 14 '16 13:01

user3719857


People also ask

How do you make a non-breaking hyphen in HTML?

To add real spaces to your text, you can use the   character entity. Tip: The non-breaking hyphen (‑) is used to define a hyphen character (‑) that does not break into a new line.

Is there a non-breaking hyphen?

Insert a nonbreaking hyphen Click where you want to insert the nonbreaking hyphen. On the Insert tab, in the Symbols group, click Symbol. In the box that opens, click More Symbols. In the Symbol dialog box, on the Special Characters tab, click the Nonbreaking Hyphen row to highlight it, and then click Insert.

How do you insert a nonbreaking en dash?

After typing/inserting the en dash, go to Insert and then Symbols and select Special Characters and choose No-Width Non Break. If you need it regularly you can assign a shortcut to it.

How do you keep a hyphenated Word together in HTML?

You can use ‑ which is a Unicode NON-BREAKING HYPHEN (U+2011).


1 Answers

Use ‑ instead of -, see the following example:

.box {
  border:1px solid #000;
  width:40px;
  word-wrap:normal;
}
<div class="box">
  This is a test&#8209;case / test-case
</div>
like image 93
Sebastian Brosch Avatar answered Nov 15 '22 21:11

Sebastian Brosch