Directions like right, left, bottom, top, used in properties like margin, padding or border only make sense in left-to-right + top-to-bottom (horizontal-tb) writing mode.
Now we have new way of writing these, independently of writing mode.
Quote from caniuse.com:
Logical properties and values provide control of layout through logical, rather than physical, direction and dimension mappings. These properties are writing-mode relative equivalents of their corresponding physical properties.
The logical directions become more and more common, for example are they used with flexbox or grid, so applying them to all CSS properties totally makes sense and will surely become the new standard.
Details how it works can be found in the W3 Spec.
TLDR:
vertical direction = inline flow
horizontal direction = block flow
start = where you start writing
end = where you end writing
so in default writing mode horizontal-tb:
text-align: left; becomes text-align: start;
float: right; becomes text-align: end;
margin-right becomes margin-inline-end
padding-top becomes padding-inline-start
border-bottom becomes border-block-start
and so on.
Following the tailwind naming scheme, the functional tailwind classes could be:
m{i|b}{s|e}-{size} --> e.g. mis-1 (better known as ml-1)
text-{i|b}{s|e} or text-{inline|block}-{start|end} 馃
Since this is not as intuitive to many users I and and the physical directions are not going to be depreciated soon, guess these just be an additional set of classes instead of replacing the current ones.
What do you think?
I had almost the same naming convention with a plugin experiment I had. The only issue with it is the vertical margin/padding which would be the same as the bottom margin/padding. mb-{size}
I eventually went with two letters for the short form of the axes (bl and il).
There is also a conflict with insets, as from v1 there is an actual inset class, there is no difference in naming with logical/physical dimensions.
Two more options to avoid conflicting margin-bottom and margin-block acronyms.
Revert the acronym. 馃殌
im: Inline Marginism: Inline Start Marginiem: Inline End Marginbm: Block Marginbsm: Block Start Marginbem: Block End MarginPrefix with l for logical. 馃帀
lmi: Logical Margin Inlinelmis: Logical Margin Inline Startlmie: Logical Margin Inline Endlmb: Logical Margin Blocklmbs: Logical Margin Block Startlmbe: Logical Margin Block EndI'd rather this be developed as a plugin first and if it gets enough traction we can explore adding it to core. Hopefully by then the Chromium version of Edge will have replaced the current version so the browser support will be better as well.
Most helpful comment
Hi eveyone,
as Adam (@adamwathan) recommended I made this proposal as a plugin, your feedback and review is appreciated!
Github - NPM
I tried to explain everything in the documentation.