Comments (1)
@muhamed87 Thanks for your report.
It sounds like want to use scaleX()
to horizontally mirror a visual element for RTL mode. That makes perfect sense and is a common technique I've used myself as well. Especially with complicated icons this can save time and removes the need for producing separate icons for example.
However, while this solution is great, it does require the addition of 1 manual rule to make it work.
scaleX(1)
on its own does not do anything in LTR mode. As such, we cannot reliably use this as an instruction to inverse it in RTL mode.
In this case an RTL-only rule would work best, by using @noflip
.
For example:
.arrow-start { /* Points left in LTR mode. */
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 10px solid blue;
}
/* @noflip */ [dir=rtl] .arrow-start {
transform: scaleX(-1);
}
Note that in this particular example there is actually no need for an override with @noflip
since CSSJanus would normally already replace border-right with border-left, which naturally makes the triangle point the other way in RTL.
from node-cssjanus.
Related Issues (20)
- Any way to deal with negative `text-indent`? HOT 2
- Avoid flipping "ltr" or "left" in a data URI HOT 1
- Support flipping mutiple values under a text-shadow or border-shadow rule HOT 2
- Release v1.3.0 HOT 1
- Getting Error "TypeError: cssjanus.transform is not a function" HOT 1
- Translate RegExp's are too relaxed which can result in skipping replacements HOT 1
- How to use this package with "create-react-app" HOT 1
- Request: VS Code extension HOT 1
- Flip transform: scaleX(-1) HOT 2
- end event listener registration error HOT 2
- does not flip when a semicolon is not present at the end of a shorthand rule HOT 3
- Does not flip shorthand properties with expressions in them HOT 3
- The demo is broken HOT 1
- /* @noflip */ doesn't work. HOT 3
- CSSJanus changes right to left in selectors when using the general sibling combinator
- Just wanted to sat thank you HOT 1
- Inconsistent flipping behavior breaks custom CSS properties HOT 1
- Tilde (~) subsequent-sibling combinator causes 'left' in class names to switch to 'right' HOT 2
- License has generic copyright HOT 2
- Flipping for `background` mistakes percentages in color functions for background-position HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-cssjanus.