Hyphens or underscores in CSS and HTML identifiers?

Posted by Török Gábor on Stack Overflow See other posts from Stack Overflow or by Török Gábor
Published on 2009-11-06T09:03:22Z Indexed on 2010/04/04 16:43 UTC
Read the original article Hit count: 417

As both hyphen (-) and underscore (_) are valid characters in CSS and HTML identifiers, what are the advantages and disadvantages using one or the other? I prefer writing CSS class names with hyphens (e.g. field-text) and underscores for IDs (e.g. featured_content). Is there a best practice or it's only the matter of taste?

© Stack Overflow or respective owner

Related posts about html

Related posts about css