DEV Community

Vijay SRJ
Vijay SRJ

Posted on

How to create a custom element (tag) in HTML5?

Until HTML5 , reusing a piece of html code was not straightforward. Thanks to HTML5 , web components came into picture. Now you can create your own custom components and include them in your HTML code using custom tags. And you can reuse them anywhere else in your application by declaring the custom tags just like you declare your standard HTML tags.

You do this by extending HTMLElement class in Javascript.

Here is a quick demo on it:

Top comments (0)