zoukankan      html  css  js  c++  java
  • css标识符命名

    一般写css中常用的标识符命名是英文单词组合。

    某天碰到有人问到可以使用._1这样子的命名吗?然后傻眼了,没有想过是否有这种命名方式

    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).
    
    在CSS标识符命名中可以使用包含字符(a-zA-Z0-9)和ISO 10646字符字符集中的字符,也可以使用连字符(-)和下划线(_);同时,起始部分不能是数字,或两个连字符"-"或一个"-"连字符后跟一个数字。标识符也可以包含转义字符和任何ISO 10646字符数字代码。

    css中的特殊字符包含:!, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^,`, {, |, }, ~
    这些字符需要转义才能用于命名,在其前面加上反斜杠""转义来取消这些字符的特定含义。

    <style>
        ._1{color: #f90; border: 1px solid #f90; padding: 20px;}
        .#{color: #f00; border: 1px solid #f00; margin: 20px auto;}
    </style>
    <div class="_1">标识符命名</div>
    <div class="#">需要转义字符</div>
  • 相关阅读:
    4. Validator校验器的五大核心组件,一个都不能少
    如何快速提高数据库查询效率
    linux系统简介
    echo命令
    Linux-->基本查找及vim使用
    jmeter.5.4.1
    Shell文本处理三剑客:grep、sed、awk
    Linux 下的dd命令使用详解
    Linux添加硬盘和挂载两个命令fdisk和mount的使用
    Linux系统常用命令速查手册
  • 原文地址:https://www.cnblogs.com/wanbi/p/4296352.html
Copyright © 2011-2022 走看看