How to define conditional line break in html?

html

Solution

There are two ways to specify a conditional (allowed) line break: the `<wbr>` tag, which is being standardized in HTML5, and the zero width space character (U+200B, `&#x200b;`). Both work well in modern browsers, but if you wish to cover old browsers, there are many tricky issues.

On the other hand, any space is normally treated as allowing a line break. So what might really need is just the use no-break spaces instead of spaces in situations where a line break must not appear.

Example:

7&nbsp;380&nbsp;000&nbsp;Ft, 159&nbsp;125&nbsp;Ft termékdíjjal

The source is more readable if you use the no-break space U+00A0 itself instead of the `&nbsp;` reference. The method of typing it varies by program.

Problem

I would like this string to break at `*` if necessary (there is no more place to write). ``` 7 380 Ft,*159 Ft termékdíjjal ``` like ``` 7 380 000 Ft, 159 125 Ft termékdíjjal ``` How to achieve this in html? `&nbsp;` produces "wrong" breaking, like: ``` 7 380 000 Ft, 159 125 Ft termékdíjjal ```

Original source

Related problems