HTML <content> (The Shadow DOM Content Placeholder) Tag

❮ Previous Reference Next ❯

Deprecated: Not Supported in HTML5.

Example

<body>
<div>
  <h4>My Content Heading</h4>
  <p>My content text</p>
</div>

<script>
  // Get the <div> above.
  var myContent = document.querySelector('div');
  // Create a shadow DOM on the <div>
  var shadowroot = myContent.createShadowRoot();
  // Insert into the shadow DOM a new heading and
  // part of the original content: the <p> tag.
  shadowroot.innerHTML =
  '<h2>Inserted Heading</h2> <content select="p"></content>';
</script>
</body>

Meaning

The <content> HTML element—an obsolete part of the Web Components suite of technologies—was used inside of Shadow DOM as an insertion point, and wasn't meant to be used in ordinary HTML.

It has now been replaced by the <slot> element, which creates a point in the DOM at which a shadow DOM can be inserted.


Standard Syntax

<content>...</content>

Browser Support




Status







Attributes

Attribute Value Description
select element A comma-separated list of selectors. These have the same syntax as CSS selectors. They select the content to insert in place of the <content> element.



Global Attributes

<content> element also supports the Global Attributes in HTML.

❮ Previous Reference Next ❯