Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid incorrect wrapping of some words in RTL languages (Farsi, Arabic)

In Farsi, Arabic and some other RTL languages, letters are connected to each other (e.g. سیب), but not always (e.g. می شود). The problem this causes is that sometimes the whitespace will cause half a word to wrap over to the next line.

Example of incorrect wrapping

This is totally incorrect, but I don't want to disable the whole wrapping style of the paragraph. In Microsoft Word, this problem is dealt by pressing ctrl+shift+space. This enters a different white space between the letters that doesn't wrap. How would I achieve something similar in HTML and CSS?

Here's a jsFiddle example: https://jsfiddle.net/gb0p72b2/.

like image 890
azerafati Avatar asked Nov 27 '25 10:11

azerafati


1 Answers

You are looking for a non-breaking space character. In MS Word, ctrl+shift+space inserts a non-breaking space character. To do that in HTML use this   instead of the normal white-space. Check out the JSFiddler: https://jsfiddle.net/6k0p9h5k/

like image 102
Aboodz Avatar answered Nov 30 '25 05:11

Aboodz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!