Using a slash as an identifier attribute

Just discovered that you can use the Unicode character (any?) As attribute identifiers, and this opens up a whole new world for me.

But I am trying to set the ID attribute /nameand it does not want to work. Here is what I have:

http://jsfiddle.net/z2xkm9pr/

#\\/name\\/ {
    display:none;
}
#\\/name\\/:target {
    display: inline-block;
}
#\\/name\\/:target ~ .open {
    display: none;
}

What am I doing wrong? Or is this impossible to achieve? Should I revert to using ☠?

ALSO: In my last CSS, I use [id*='work-']to select all divs with work ID, how to use / name for this?

+4
source share
1 answer

id attribute , HTML5 , , . , , , id HTML, .

, CSS, (, , # ) " [a-zA-Z0-9] ISO 10646 U + 00A0 , (-) (_), , , ", , \.

jsfiddle HTML id="#\\/name". , #, \, /. . - , #\#\\\\\/name.

, # . , :

#\\\\\/name {
    display:none;
}
#\\\\\/name:target {
    display: inline-block;
}
#\\\\\/name:target ~ .open {
    display: none;
}
<div id="wrapper">
    <div id="\\/name">I'm alive!</div>
    <a class="open" href="#\\/name">Open</a>
</div>
Hide result
+6

All Articles