@namespace CSS At-Rule

Description

The @namespace CSS at-rule declares a namespace prefix and associates it with a given namespace name. It can also be used to declare a (non-prefixed) default namespace.

Syntax

namespace <namespace-prefix>? [ <string> | <url> ];
where 
<namespace-prefix> = <ident>

Values

  • none

Example

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

/* This matches all XHTML elements, as XHTML is the default unprefixed namespace */
a {}

/* This matches all SVG
elements */
svg|a {}

/* This matches both XHTML and SVG
elements */
*|a {}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
9121181
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
37184X1X

Last updated by CSSPortal on: 1st December 2019