Re: [csswg-drafts] [css-variables][css-pseudo] Question about setting variable values in pseudo classes (#10778)

Yup, to get around this restriction you need to use separate "visited" variables, and then apply them in the pseudoclass, like:

```css
:root { 
  --link-color: red;
  --visited-color: purple;
}
a {
 color: var(--link-color);
}
a:hover {
  --link-color: green; /* or set this in a third variable at root for consistency, whatever */
}
a:visited {
  color: var(--visited-color);
}
```

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10778#issuecomment-2310981650 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 26 August 2024 20:02:42 UTC