Design and CSS styles
Version 6.x > Design and CSS styles > Underscores not valid in CSS identifiers? View modes: 
User avatar
Member
Member
matt.barry-stockhouse - 4/30/2012 12:56:53 PM
   
Underscores not valid in CSS identifiers?
I'm using the 960 grid system on a new Kentico site. When I view the CSS output I notice the following error at the bottom of my CSS file:

Minification failed (line 32): An underscore is not a valid CSS1 or CSS2 identifier character

This occurs on 960gs CSS classes such as the following:

.container_16 {
float:left;
}

Is it true that underscores are invalid in CSS identifiers? Or is this a bug in the minifier?

User avatar
Member
Member
kentico_michal - 5/1/2012 2:31:19 AM
   
RE:Underscores not valid in CSS identifiers?
Hi,

Could you please try to apply the latest hotfix if you have done so already as we encountered a few bugs related to minification. Thank you.

Best regards,
Michal Legen

User avatar
Member
Member
matt.barry-stockhouse - 5/1/2012 11:47:24 AM
   
RE:Underscores not valid in CSS identifiers?
I applied the most recent hot fixes so that I'm up to v6.0.29 (SP1)‎. I'm still seeing the same error:

Minification failed (line 444): An underscore is not a valid CSS1 or CSS2 identifier character

User avatar
Member
Member
kentico_michal - 5/6/2012 2:04:41 AM
   
RE:Underscores not valid in CSS identifiers?
Hi,

Kentico CMS uses a third-party css parser so this is something that Kentico CMS cannot change. So, I would recommend you to use CSS identifiers without underscores.

Best regards,
Micha Legen

User avatar
Member
Member
ksigman-canyonco - 6/12/2012 11:29:46 PM
   
RE:Underscores not valid in CSS identifiers?
Hi Matt. Did you end up having any luck with implementing the 960 grid system? If so, would you mind sending me an email and chatting with me about this? Thanks!

Keri Sigman

User avatar
Member
Member
matt.barry-stockhouse - 6/21/2012 12:26:30 PM
   
RE:Underscores not valid in CSS identifiers?
Hi Keri:

Yes, I simply copied the contents of the 960_16_col.css file into my Kentico stylesheet. The issue is that 960gs uses underscores in its identifiers. The underscores will break Kentico's minifier, but the CSS will continue to work in an unminified state.

-Matt

User avatar
Member
Member
Andre - 6/23/2012 6:50:54 AM
   
RE:Underscores not valid in CSS identifiers?
I saw some slides from a presentation about 960.gs made by Nathan Smith (the creator of 960.gs) and a Drupal expert. The respective examples used hyphens instead of underscores in the CSS class names as this is The Drupal Way. So, I would just do the same...

User avatar
Member
Member
Andre - 6/21/2012 10:05:34 AM
   
RE:Underscores not valid in CSS identifiers?
Underscores are an invalid character in CSS1 - see CSS1:

in CSS1, selectors (element names, classes and IDs) can contain only the characters A-Z, 0-9, and Unicode characters 161-255, plus dash (-); they cannot start with a dash or a digit; they can also contain escaped characters and any Unicode character as a numeric code (see next item).

User avatar
Member
Member
Andre - 6/21/2012 10:12:57 AM
   
RE:Underscores not valid in CSS identifiers?
I just want to add that underscores are a valid character in CSS2:

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".

User avatar
Member
Member
kentico_michal - 6/27/2012 3:01:11 AM
   
RE:Underscores not valid in CSS identifiers?
Hi,

Could you please try to apply the latest hotfix as we made a few changes (hotfix 6.0.33) and underscores should be considered as a valid characters.

Best regards,
Michal Legen

User avatar
Member
Member
matt.barry-stockhouse - 7/6/2012 3:54:34 PM
   
RE:Underscores not valid in CSS identifiers?
This appears to be fixed now. Thank you for your help!