📜 ⬆️ ⬇️

Watch out!

As is known, in most European languages, the text is adopted from left to right, and in some Middle Eastern languages, the text is adopted from right to left. If the Unicode character is not a letter of the alphabet (such are punctuation marks and Arabic numerals), then by default in the browser it accepts the orientation of the preceding text (for example, appears to the left of the text preceding it in the HTML code, if this text was Semitic).

However, it also happens that the orientation of some text can be any (for example, the username when it is taken from the database), but the position of the subsequent punctuation and numbering (for example, for the uniformity of items in the list of user names of the site) should correspond to this text , and the orientation of the rest of the document. It is clear that then such a text, the orientation of which is not known in advance, will have to be somehow screened from the rest of the document.

The traditional means of such screening is to set the text of the corresponding CSS property (code <span style = "unicode-bidi: isolate"> ... </ span> ). However, this is a long time to write, and the span tag (as is known) is not semantic, and browsers are still allowed to ignore CSS, if that is their setting. It would be better if there was a special HTML tag for such an escape.
')
And such a tag was actually introduced by WhatWG in subsection 4.6.23 of the HTML5 draft draft.

The new tag is called <bdi> , abbreviated from the English words "bi-directional isolation" (in translation - "bidirectional screening"). According to MDN , <bdi> support will appear in two new models of browsers at once - Google Chrome (starting from version 16) and Mozilla Firefox (from version 10).

Source: https://habr.com/ru/post/131503/


All Articles