What does a pipe (|) do in a CSS selector?

前端 未结 2 1184
感情败类
感情败类 2020-12-30 19:49

I found the following definition in a CSS stylesheet :

*|*:link {color:#ff00ff;}

What\'s the use of the |? Is it

相关标签:
2条回答
  • 2020-12-30 20:36

    It separates namespace and element name.

    Unless a default namespace has been defined, *|*:link is a complicated way of writing *:link or just :link.

    In an XML document, you could have the following:

    <el xmlns="http://name/space" />
    <style>
    @namespace namespace_example url(http://name/space);
    namespace_example|el {background: red;}
    </style>
    
    0 讨论(0)
  • 2020-12-30 20:38

    It is used with namespaces, defining the namespace|element. For more information, have a look at the documentation here. If there is no namespace defined, it is pointless to define the selectors with namespace *.

    0 讨论(0)
提交回复
热议问题