visit
When we work with multilingual sites, we have to adjust our elements as per writing mode, directionality, and text orientation.
In many languages, texts work from LTR(Left to Right) like in English, but in many languages, texts also work from RTL(Right to Left) like French**.** So if your application works in both languages, then you have to adjust your text alignment as per the language in which your application is running on the browser.
suppose we have added text-align: right; then for English Lang, it will work correctly. but for French we have to apply text-align: left; for the same Element. because English works as LTR and French works as RTL.
So using only 1 property that can work text-align: right; for LTR and text-align: left; for RTL. that will overcome the line of code and customization as per lang.
.alignRight{
text-align: right;
}
.alignLeft{
text-align: left;
}
.alignRight{
text-align: end;
}
.alignLeft{
text-align: start;
}
These properties correspond to the margin-top, margin-bottom, margin-left, and margin-right properties. The mapping depends on the element’s writing mode, direction, and text orientation.
Problem- when we change writing mode from vertical-lr to vertical-rl or vice versa, then these properties should work another way round. Ex margin-top should work as margin-bottom on change of writing mode.
.margin-top{
margin-top: 10px;
}.margin-bottom{
margin-bottom: 10px;
}
.margin-left{
margin-left: 10px;
}.margin-right{
margin-right: 10px;
}
.margin-top{
margin-block-start: 10px;
}.margin-bottom{
margin-block-end: 10px;
}
.margin-left{
margin-inline-start: 10px;
}.margin-right{
margin-inline-end: 10px;
}
vertical-lr
a mapping equal to
margin-block-start = margin-left
margin-block-end = margin-right
margin-inline-start = margin-top
margin-inline-end = margin-bottom
vertical-rl
a mapping equal to
margin-block-start = margin-right
margin-block-end = margin-left
margin-inline-start = margin-top
margin-inline-end = margin-bottom
<html>
<html lang="en">Even more specific<html lang="en-us">
use "hreflang" attribute if linked page is in other langs <a href="/path/to/german/version" hreflang="de">German version</a>
if the link text is also in other "lang" then define lang attribute too
<a href="/path/to/german/version" hreflang="de" lang="de">Deutsche Version</a>