Is there a way to create your own html tag in HTML5?

You can use custom tags in browsers, although they won’t be HTML5

Let’s assume you want to use a custom tag element called <stack>. Here’s what you should do…

Very important note: Although browsers support creating a custom element, it’s not officially supported by the HTML5 standard. Technically, custom elements are verboten. You can do it, and make your HTML look all nice and semantically important, but you are breaking the standard if you do


Normalize its attributes in your CSS Stylesheet (think css reset) – Example:

stack{display:block;margin:0;padding:0;border:0; ... }


To get it to work in old versions of Internet Explorer, you need to append this script to the head (Important if you need it to work in older versions of IE!):

<!--[if lt IE 9]> 
 <script> document.createElement("stack"); </script>

Then you can use your custom tag freely.


Feel free to set attributes as well.

<stack id="st2" class="nice"> hello </stack>
Try it yourself

Hope this was helpful:)