2
In CSS, I often like to use some "modifying classes" to extend functionality.
Example:
.btn{
background-color: red;
height: 50px;
}
.btn.btn-outlined{
background-color: transparent;
color: red;
}
I have a question about the property transform
. Sometimes I put some things there, to normalize the centralization of the element, for example. But when using another class to modify the main one, I always end up having to redeclare everything again.
Example:
.principal{
transform: rotateX(25deg) translateX(-50%) scale(1.2);
}
In the above case, if I wanted to add something to the transform
, for example, a skew
, I couldn’t do it without having to practically copy the entire line.
I would like to know if there is a less repetitive solution in the CSS about this transform
.
Some properties often have long declarations, such as font
and background
. Someone could declare a font: 12px arial bold
. But most of them have modifiers like background-color
, background-size
, background-repeat
, font-size
or font-weight
which facilitate the exchange of a share of the property.
I wonder if there’s anything like that for transform
.
With preprocessors it is possible to extend a selector, but I believe that it superimposes the base style, maybe with some plugin it is possible to bypass
– Costamilam