Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

css

I found the following definition in a CSS stylesheet :

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

What's the use of the |? Is it some sort of CSS Hack?

like image 733
Kraz Avatar asked Jun 27 '11 19:06

Kraz


People also ask

What does a CSS selector do?

A CSS selector is the first part of a CSS Rule. It is a pattern of elements and other terms that tell the browser which HTML elements should be selected to have the CSS property values inside the rule applied to them.

What does Hash do in CSS?

signifies a class name while the hash ( # ) signifies an element with a specific id attribute. The class will apply to any element decorated with that particular class, while the # style will only apply to the element with that particular id.

What is a selector in style rule?

In CSS, pattern matching rules determine which style rules apply to elements in the document tree. These patterns, called selectors, may range from simple element names to rich contextual patterns. If all conditions in the pattern are true for a certain element, the selector matches the element.


1 Answers

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> 
like image 50
phihag Avatar answered Sep 29 '22 17:09

phihag