css选择器\数字,转义数字意义
css数字选择器其中出现\数字类型,css数字选择器名称有什么意义。
.\39 {
background-color: #ccc;
color: red;
}
/* '\' 的unicode码是5c */
.unicode\5c {
background-color: #666;
color: white;
}
.8 {
background-color: #DDD;
color: blue;
}
当css class名是数字开头或者包含特殊字符的话,在写CSS样式的的类名的时候要进行Unicode码转换,不过CSS语法是不允许这样做的,这会让代码很难阅读
来源:https://www.zhihu.com/question/49682658/answer/120692563
DEMO
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.\39 {
background-color: #ccc;
color: red;
}
/* '\' 的unicode码是5c */
.unicode\5c {
background-color: #666;
color: white;
}
.8 {
background-color: #DDD;
color: blue;
}
</style>
</head>
<body>
<div class="9">9</div>
<div class="unicode\">unico</div>
<div class="8">8</div>
</body>
</html>
加支付宝好友偷能量挖...

