Giter Club home page Giter Club logo

Comments (1)

Krinkle avatar Krinkle commented on June 3, 2024

@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);
}

screen shot 2017-04-20 at 13 59 45

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.