DEV Community

Vijay SRJ
Vijay SRJ

Posted on

1

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:

https://fullstackdeveloper.guru/2020/11/06/how-to-create-a-custom-element-html-tag-in-html/

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay