MDN Web Docs

Value

A string containing the prefix associated to this namespace. If there is no prefix an empty string.

Examples

The stylesheet includes two namespace rules. The first has no prefix the second the prefix svg. Two CSSNamespaceRule objects will be returned. The value of the prefix property for the first will be an empty string, for the second svg.

css

@namespace url("http://www.w3.org/1999/xhtml");
@namespace svg url("http://www.w3.org/2000/svg");

js

let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].prefix); // an empty string ""
console.log(myRules[1].prefix); // "svg"

Specifications

Specification
CSS Object Model (CSSOM)
# dom-cssnamespacerule-prefix

Browser compatibility

Help improve MDN

Yes No

Learn how to contribute

This page was last modified on by MDN contributors.

Read the original on developer.mozilla.org ↗