The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS scss variable naming

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #46422


    i am in the process of creatinga responsive grid with scss and I was naming my variables like so

    $1col: 6.25%;
    $2col: 12.5%;
    etc etc

    I was getting scss compilation errors saying ‘

    > > Syntax error: Invalid CSS after “$”: expected identifier, was “1col: 6.25%” on line 75 of C:………….

    So guessing the identifier they were talking about was a css identifier I renamed the variables to

    $width1col: 6.25%;
    $width2col: 12.5%;
    etc etc

    and the compilation succeeded, does there really have to be a css identifier name in ever variable I create in scss? why does the name matter? I have seen variable names called simply $blue that work, why do these work and not other descriptive names that dont include identifiers?

    I feel like I am missing something obvious, what is it?


    Classes and IDs cannot start with numbers so I would guess that the same is true of variables.


    You are dead right thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.