rplus.github.io
rplus.github.io copied to clipboard
[POST] CSS valid class name
最近看了些 css framework & naming method 遇到一些怪怪的 className 寫法 於是來確認一下到底該怎麼寫~
基本上
先不要考慮大範圍的 unicode,簡單地說就是下面這樣 (regex),
-?[_a-zA-Z]+[_a-zA-Z0-9-]*
via: http://stackoverflow.com/a/449000/5940513
開頭可以是
- hyphen
- - underscore
_ - 字母
但 - 開頭的就有另外的限制
第二字不可以是 -,也不能是數字
基本上就這樣 但如果是要用 escape 的話,你要放什麼字都可以就是了... 例如:https://mothereff.in/css-escapes
onetab list: http://www.one-tab.com/page/TFIJMJQeSPOTpvLRh9A2Ng
tw: https://twitter.com/RplusTW/status/711932154091974658 fb: https://www.facebook.com/rplus.tw/posts/1081576258576823
怪怪 naming: https://github.com/1000ch/grd http://rscss.io/variants.html#dash-prefixes
