Is it legal to create tags with an arbitrary name?

<style> sct { display table-row; background-color: red; } </style> <script> document.createElement('sct'); </script> <!--Поддержка ie--> <sct>somecontent</sct> <!--Тег произвольного названия--> 

Why is it so important to me
Sometimes you can get confused when you read the code, it is inconvenient to look at <div class = "sct"></div>
I know that there are comments to not get confused, but just very interesting. It even works on grandfather ie6 , when I pass code validation, it pops up as an error. One question is, will it affect the operation of the site if I use it instead of for example a div ?

1 answer 1

Translation of the article Are custom elements valid HTML5? In Russian:

The Custom Elements specification is available in Chrome and Opera, and will soon be available in other browsers . It provides the means to register custom items in the official order.

Custom elements are new types of DOM elements that can be defined by the author of the code. Unlike decorators , which are stateless and short-lived, custom elements can encapsulate states and provide script interfaces.

Custom elements are part of the larger W3 specification, called Web Components , along with templates, HTML import, and Shadow DOM.

Web components allow web application authors to define widgets with a level of visual richness and interactivity that are not possible only with CSS, as well as ease of layout. But reuse is not possible with script libraries at this time.

However, from this Google Developer article about custom elements states:

The name of the user element must contain a dash ( - ). Thus, <x-tags> , <my-element> and <my-awesome-app> all valid names, while <tabs> and <foo_bar> are not. This requirement is that the HTML parser be able to distinguish user elements from ordinary elements. It also provides direct compatibility when new tags are added to HTML.

Additional links:

Source link SO: Are custom elements valid HTML5? (Question of 2012) Based on the foregoing, it is possible to come to a logical conclusion: it is possible and allowed .