0

:root {
    --color-primary: #1999CC;
    --gr-deg-x: 270deg;
    --gr-primary-fade-x: linear-gradient(var(--gr-deg-x), var(--color-primary) 0%, rgba(0, 0, 0, 0) 50%);
}

.myselector {
    --gr-deg-x: 180deg;
    background: var(--gr-primary-fade-x);
  height: 100px;
  width: 100%;
}
<div class="myselector"></div>

The background gradient angle for .myselector is still 270deg instead of 180deg. What am I missing?

Alex
  • 9,911
  • 5
  • 33
  • 52
  • I don't think it's possible to update a variable in another variable. But you can do the following: `background: linear-gradient(var(--gr-deg-x), var(--color-primary) 0%, rgba(0, 0, 0, 0) 50%);`. So you will need to write the gradient again and not using a variable. Or you can make a variable for each direction. Hope it helps :) – WebPrograme Mar 22 '23 at 12:25
  • @WebPrograme Do you know of any spec description of this? Some off. documentation? – Alex Mar 22 '23 at 13:16

0 Answers0