6

CSS Lint thinks there is something wrong here. And so does the W3C CSS Validator. They are probably right and I am wrong, but can someone please help me understand why this is wrong?

CSS:

.my-class {
    width:  calc(((100% - 15%) / 3 - 1px) * 3 + 10%); /* for 3 columns */
}

Error message:

Expected RBRACE at line 2, col 22.

By the way, browsers seem to be more on my side.

3 Answers 3

3

It seems to be a problem with CSS Lint currently. Just a bit of bad parsing.

CSS3 calc is however still not a recommendation by W3C, but it looks very likely to be a standard soon. A warning would be the appropriate message from CSS Lint, of course.

4
  • Do you happen to mean "still NOT a recommendation by W3C" or it's just me who is wrong? Commented Mar 30, 2014 at 18:35
  • Yes, I happen to mean that. Edited. ;-)
    – Leo
    Commented Mar 30, 2014 at 18:37
  • Thanks for the editing, Itay. I should learn to make links here.
    – Leo
    Commented Mar 30, 2014 at 18:39
  • Yhea, I think that the good look of the content is very important. It not only improves the readability of the content but it also makes it easier to understand. Commented Mar 30, 2014 at 18:43
1

Per this article it seems that calc() isn't supported very well.

2 years ago

The parser does not support calc()

It seems like it is sort of fixed, but not entirely.

2
0

This is probably caused by the fact that arithmetics is an experimental feature of CSS and is certainly not in any of the CSS Specifications.

Those services are created according to CSS specifications and no wonder they found an error in your code. The entire statement is invalid according to the specs.

5
  • Thanks, Itay, yes I know, but I would expect a warning saying calc is not supported instead of this. ;-)
    – Leo
    Commented Mar 30, 2014 at 18:13
  • @Leo Yes, you are right, but I guess they haven't implemented that warning yet. Commented Mar 30, 2014 at 18:15
  • 1
    Looks like they got the parsing wrong. See my comment to to jsve.
    – Leo
    Commented Mar 30, 2014 at 18:17
  • @Leo Since you found the answer, consider posting it? Commented Mar 30, 2014 at 18:20
  • Thanks Itay. I think that will be more clear for others, yes.
    – Leo
    Commented Mar 30, 2014 at 18:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.