Re:Lit: A ridiculously small responsive CSS framework
by smlckz on Saturday May 02, 2020 @10:54PM
(#23056547)
huh? can you tell me what those \31 \33 etc. mean?
[ Parent
| on HN ]
Re:Lit: A ridiculously small responsive CSS framework
by uryga on Saturday May 02, 2020 @11:17PM
(#23056620)
TIL! as with most languages, css indentifiers can't start with numbers, but you can get around that using backslash-escapes. you'd use these classes like this:
<div class="35">
this stackoverflow answer has more info (looks like you can use any symbol you want, even spaces and [{}<>&*] !): https://stackoverflow.com/a/27882887/5534735
Re:Lit: A ridiculously small responsive CSS framework
by uryga on Monday May 04, 2020 @09:47PM
(#23075513)
just realized my usage example is misleading. as sibling comments correctly explain, \35 means
chr(0x35) == '\x35' == '5'
so the actual usage would be <div class="5">
Re:Lit: A ridiculously small responsive CSS framework
by juliend2 on Saturday May 02, 2020 @11:04PM
(#23056584)
It means:
.1{width:5%}
.3{width:22%}
.4{width:30%}
.5{width:40%}
.2{width:15%}
It's an escape sequence that lets you have non-alphabetic characters to start a CSS selector. See this for more examples: