is

The is attribute in HTML associates an element with a custom component, allowing for enhanced functionality and dynamic styling adjustments.

is attribute

The is global attribute enables a standard HTML element to function as a custom-built element. It can only be applied if the designated custom element has been defined within the document and extends the specified element type.

Example

index.html
<p is="word-count"></p>

Key Points

  • Custom Elements: The is attribute allows standard HTML elements to adopt custom behaviors, provided the custom element is already defined in the document.
  • Usage Limitation: This attribute only works with elements that extend built-in HTML elements (e.g., <p is="custom-element">), not standalone custom elements.

See also

Conclusion

The is attribute in HTML allows standard elements to adopt custom behaviors by associating them with predefined custom components. It only works when the custom element is already defined and extends an existing HTML element. This enables dynamic styling and functionality enhancements while maintaining compatibility with native HTML elements.