CSS identifier naming

Source: Internet
Author: User

The commonly used identifiers in the general write CSS are named in English word combinations.

One day I met someone asking if you could use the name _1. Then dumbfounded, did not think about whether there is such a naming method

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-za-z0-9] A nd ISO 10646 characters u+00a0 and higher, plus the hyphen (-) and the underscore (_); They cannot start with a digit, both 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). In CSS identifier naming You can also use hyphens (-) and underscores (_) with characters that contain characters (a-za-z0-9) and ISO 10646 character sets, and the starting part cannot be a number, or two hyphens "-" or a "-" hyphen followed by a number. Identifiers can also contain escape characters and any ISO 10646 character numeric code.

Special characters in CSS include:!, ", #, $,%, &, ', (,), *, +,,,-, .,/,:,;, <, =,;,?, @, [, \,], ^, ', {, |,}, ~
These characters need to be escaped to be used for naming, preceded by a backslash "\" Escape to remove the specific meaning of these characters.

<style>. _1{Color:#f90;Border:1px solid #f90;padding:20px;}    .\#{Color:#f00;Border:1px solid #f00;margin:20px Auto;}</style><Divclass= "_1">Identifier naming</Div><Divclass="#">Need to escape characters</Div>

CSS identifier naming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.