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>
  • 相关阅读:
    windows 7 wifi热点配置
    Java中的try catch finaly先后调用顺序
    redis php扩展
    mysql索引
    cmd操作数据库的常用命令
    php ajax解决跨越问题
    git常用命令
    php,redis分布式锁防并发
    php商城下单,可以购买多件商品,redis防高并发
    php商城秒杀,redis防高并发
  • 原文地址:https://www.cnblogs.com/wanbi/p/4296352.html
Copyright © 2011-2022 走看看