Are there any known issues with putting invalid CSS characters (`@`, `:`, `!`) In the class attribute of an HTML element?

Are there any known issues with putting invalid CSS class symbols ( @, :, !) in the class attribute of the HTML element? Like this:

<input type='text' class='compare id:txtSecondary'/>
<input type='text' class='compare @txtSecondary'/>
+3
source share
2 answers

Interesting CSS fact! Section 4.1.3 of the Recommendation Syntax and Basic Data Types (from CSS2) states ...

ISO 10646 (. ). , "B & W?" "B\& W \?" "B\26 W\3F".

, CSS:

<style type="text/css">
    .\@user { /* valid! */
        color:red;
    }
</style>

, class cdata, " , .

, - :

<div class="@user">
    This is an @user
</div>

@ :,  , . ( class - : " ." )

+6

- _, CSS.

<input id='txtPrimary' type='text' class='compare id-txtSecondary'/>
<input id='txtSecondary' type='text' />

<input id='txtPrimary' type='text' class='compare id_txtSecondary'/>
<input id='txtSecondary' type='text' />
+2

Source: https://habr.com/ru/post/1759392/


All Articles