Christoffer
Christoffer

Reputation: 615

How to append CSS transform

I am unsure if this is possible but I hope so.

I have an element with a translation transform, which I have no control over (it is set by an NPM package that I am using). I would like to set a scale transform on that element and be able to retain whatever transform the element already has, like a concatenation.

Imagine that this is similar to what I want to achieve:

transform: +scale(1.01);

Is this doable, and if so, how?

Upvotes: 0

Views: 370

Answers (2)

Rohit Khandelwal
Rohit Khandelwal

Reputation: 632

Look how CSS works in any HTML page is like you can import as many stylesheets but the stylesheet imported in the last can take all the priority. So, you can obviously override the CSS of that package component by knowing the class/id or if you can catch that particular element by any selector combination.

Also, if your CSS is imported earlier than that component's CSS, you can put !important on your CSS property. So, no other property value can override your CSS value.

You get my point! Don't mind if it sounds more blahblah.

Upvotes: 0

Libra
Libra

Reputation: 2595

As far as I know that isn't really possible, so you have two options.

  1. You can find the definition in the package for that transformation, copy it to your CSS, then add your desired changes to it.

or

  1. You can place the element inside a parent element that has your desired transformation on it, that way both work.

Upvotes: 1

Related Questions