Answer the question
In order to leave comments, you need to log in
How to make css variable reactive and dependent on Vue js variable?
Hello, while styling a linear gradient, I want to change the fill tones using a variable example
--litters-range: 25%;
background: linear-gradient(
to right,
white var(--litters-range),
rgba(87, 87, 87, 0.46) var(--litters-range)
);
Answer the question
In order to leave comments, you need to log in
Option 1:
<template>
<div :style="{ '--litters-range': myComputedProperty }"></div>
</template>
<style>
div {
background: linear-gradient(
to right,
white v-bind(myComputedProperty),
rgba(87, 87, 87, 0.46) v-bind(myComputedProperty)
);
}
</style>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question