Content with code points (entity) or unicode characters

4

At w3schools has the reference of all the characters - special, symbols, alphanumeric. I did not understand the purpose of having this representation of the characters. In the example below the output is the same, it only changes the entity.

  • When should we use CSS entity and / or when to use the character?
  • Is there a difference between writing one way or another?
  • .copy1:before{content:'
    <div class="copy1"></div>
    <div class="copy2"></div>
    <div class="copy3"></div>
    <div class="copy4"></div>
    A9'; margin-right:3px} .copy2:before{content:'©'; margin-right:3px} .copy3:before{content:'
    .copy1:before{content:'
    <div class="copy1"></div>
    <div class="copy2"></div>
    <div class="copy3"></div>
    <div class="copy4"></div>
    A9'; margin-right:3px} .copy2:before{content:'©'; margin-right:3px} .copy3:before{content:'%pre%41'; margin-right:3px} .copy4:before{content:'A'; margin-right:3px}
    A9 => © © => © %pre%41 => A A => A
    41'; margin-right:3px} .copy4:before{content:'A'; margin-right:3px}
    A9 => © © => © %pre%41 => A A => A

    %pre% %pre%
        
    asked by anonymous 22.06.2017 / 04:17

    1 answer

    4

    w3schools seems to have invented this name "css entities", inspired by html entities . This is a list of code points unicode, which can be used "escaped" with \ . But you can also use the character directly as you have shown. The current spec says what this is worth:

    So it's okay to use unicode characters directly as a value of content , as long as your file is saved and served with correct encoding - in UTF-8 case, but characters in other encodings also work if everything is being saved and served correctly.

        
    22.06.2017 / 05:16