Skip to content

Three different parse errors related to CSS variables #315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tmb-github opened this issue Aug 28, 2021 · 2 comments
Closed

Three different parse errors related to CSS variables #315

tmb-github opened this issue Aug 28, 2021 · 2 comments
Assignees
Labels

Comments

@tmb-github
Copy link

/*
Three different cases where the validator cannot parse CSS variables & reports parse errors:
*/

.aaa {
  padding-top: calc(var(--aspect-ratio-h, 1) / var(--aspect-ratio-w, 1) * 100%);
}

.bbb {
  background: linear-gradient(var(--cta-orange-light), var(--cta-orange-dark));
}

.ccc {
  margin: calc(1em + var(--header-height)) auto 3em auto;
}

/*
It reports back the following:
2   .aaa  Value Error : padding-top Parse Error ) * 100%)
6   .bbb  Value Error : background Parse Error )
10  .ccc  Value Error : margin Parse Error )) auto 3em auto
*/

@tmb-github
Copy link
Author

@ylafon Additional info: It fails even if the variables are defined, and it mistakes each variable for an unknown vendor extension:

:root {
  --aspect-ratio-h: 2;
  --aspect-ratio-w: 3;
  --cta-orange-dark: #eeb935;
  --cta-orange-light: #f4d589;
  --header-height: 60px;
}

.aaa {
  padding-top: calc(var(--aspect-ratio-h, 1) / var(--aspect-ratio-w, 1) * 100%);
}

.bbb {
  background: linear-gradient(var(--cta-orange-light), var(--cta-orange-dark));
}

.ccc {
  margin: calc(1em + var(--header-height)) auto 3em auto;
}

Untitled

@ylafon
Copy link
Member

ylafon commented Aug 31, 2021

Fixed by #316

@ylafon ylafon closed this as completed Aug 31, 2021
@ylafon ylafon self-assigned this Aug 31, 2021
@ylafon ylafon added the bug label Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants