3 ms·
> <html dir="ltr" lang="en"> This one surprised me a bit. Are there browsers that are default Right-to-Left rendering and are going to put English language ch
by jandrese 5y ago
> <html dir="ltr" lang="en">
This one surprised me a bit. Are there browsers that are default Right-to-Left rendering and are going to put English language characters backwards if you don't specify the direction?
- selfmodruntime 5y agoNo, but a screen reader that has set rtl as a default might.
- missblit 5y agoPer https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute https://html.spec.whatwg.org/multipage/dom.html#the-dir-attr... it'll default to LTR > The directionality of an element (any element, not just an HTML element) is either 'ltr' or 'rtl', and is determined as per the first appropriate set of steps from the following list: > ... If the element is a document element and the dir attribute is not in a defined state (i.e. it is not present or has an invalid value) ... > ... The directionality of the element is 'ltr'. It's not that common to see LTR explicitly specified for the document, but you could imagine some code that either outputs ltr or rtl based on the user's preferences. (Indeed I just checked and twitter puts a rtl there if you're using it in Arabic)
- dymk 5y agoThere's probably a line of code that looks like this: > echo('<html dir="$dir" lang="$lang">') (or something similar), and they unconditionally include the `dir` attribute without checking if it's already set to the default value a browser would assume.
- hombre_fatal 5y agoWhat the nay-sayers in these comments seem to not understand is that your curiosity here is a great response to TFA's question.