How to Force or Avoid Line Breaks at Hyphens
It is possible to force or avoid line breaks inside words with hyphens
(U+2010
). This can be useful, for example, inside tables that have product
references if you want the display to remain on a single line (or to split it on multiple
lines). To achieve this, you can use the -oxy-break-line-at-hyphens
property:
The accepted values are:
- auto
- Words are hyphenated automatically according to an algorithm that is driven by a hyphenation dictionary. This can lead to line breaks at hyphens.
- avoid
- Words are still hyphenated automatically except no line break will occur on hyphens.
- always
- Words are still hyphenated automatically except line breaks will be forced on hyphens.
Example:
Suppose you have a products table like
this:
<table>
<row>
<cell>Product-1233-55-88</cell>
<cell>120</cell>
<row>
<row>
<cell>Product-1244-66-99</cell>
<cell>112</cell>
<row>
</table>
and the following rule in a CSS
stylesheet:
table {
-oxy-break-line-at-hyphens: avoid;
}
In the output, the list of product references will be displayed in a single line. On the
contrary, setting the property value to always
, will force a break after each
hyphen.