Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

W3C CSS Validation parse error on variables

I am passing my .css file through the W3C CSS Validation package on Atom and it gives me a "Parse Error" message virtually to all variables created for the sake of an exercise. Here below there is the beginning of the :root pseudo-class (but all the remaining variable declarations are as just as faulty)

I already tried to re-write them from scratch, replace them or change the values only to check the behaviour, but nothing changes it.

:root {
  --primary-color: #781820;
  --secondary-color: #ABABAB;
  --tertiary-color: #cead00;
  --backup-color: #FAFAFA;
...

Other than fixing the errors, I'd like to understand where they lie to better understand the process.

like image 594
cgobbet Avatar asked Aug 26 '19 16:08

cgobbet


Video Answer


1 Answers

As stated, this is a non-issue. CSS is moving and changing too fast for the Jigsaw W3C CSS validator to keep up, and it can no longer be relied on for checking anything other than the most mature feature sets such as those of CSS2, and of the earliest CSS3 specs.

It's a shame that it can't even be used reliably to check for careless errors now (which is what it's always been intended for) because the real errors are constantly getting occluded by so many of these fake ones. For example, it may not spot a real typo because it was thrown off a few lines up by one of these features it doesn't support.

The most reliable validator these days is to test in browsers and assume that if it works consistently across the board, then it's valid. Or, when in doubt, ask a question here and hope someone familiar with the specs will answer. If anyone asks you if you've tried validating your CSS, point them to me.

like image 175
BoltClock Avatar answered Nov 15 '22 04:11

BoltClock