You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browsers localize automatically quotation marks if a lang attribute is provided which is great, but we can do much more to enhance and simplify experience of developers but also authors on the web.
In French, exclamation and question mark both require a non-breaking space before them, on the contrary of English. Often, people on the web use normal space which create orphan sign at the end of a new line.
Currently, developers aware of this problem solve it by:
Replacing space characters before ! and ! in text with or \xa0
Using white-space: nowrap; CSS property and adding an HTML element encompassing the last word and the sign ! or ? of a sentence
This seems to me like a fair request.
As the author of the want said, the following html code will produce different results if you change the value of the lang attribute:
<!DOCTYPE html><htmllang="fr"><head><metacharset="utf8"></head><body><q>this is a quote</q></body></html>
With fr:
With en:
I don't know what authoring mechanism could be put in place for this, but something similar to generate correct sentence endings seems useful.
Hi, @bkardell asked me to look at this issue, which I agree it's a fair request indeed.
As a matter of fact, what is requested might be the expected behavior for any lang using Unicode. The UAX14 spec states that the exclamation and question marks are defied as EX class, which specifically prohibit breaking before these characters.
EX | Exclamation/ Interrogation | “!”, “?”, etc. | Prohibit line breaks before
Additionally, the white-space character is defined as BA class (break-after), which prohibits breaking before the space.
Browsers localize automatically quotation marks if a
lang
attribute is provided which is great, but we can do much more to enhance and simplify experience of developers but also authors on the web.In French, exclamation and question mark both require a non-breaking space before them, on the contrary of English. Often, people on the web use normal space which create orphan sign at the end of a new line.
Currently, developers aware of this problem solve it by:
Some links to illustrate the issue:
HTML authoring in French
Whitespace before some punctuation characters in French: is there a CSS way to avoid lines breaking? - Stack Overflow
Space Yourself
https://webwewant.fyi/wants/5ffb01b21e3e3f6db4eb6404/
The text was updated successfully, but these errors were encountered: