create your own HTML tags code example

Example 1: custom html tags

//HTML
<my-tag id="yourId" some-attr="someval"></my-tag>

//CSS
my-tag {
	color: red;
}

Example 2: how to create a html tag

<html></html>
<!--this is how you do this-->

Example 3: create custum tage html

The document.registerElement() method is used to create a custom HTML element. This should be passed as the name of your custom element along with an (optional) object that defines the API.

var XTreehouseElement = document.registerElement('x-treehouse');
document.body.appendChild(new XTreehouseElement());

<x-treehouse></x-treehouse>

Tags:

Html Example