What’s stopping us from using custom html tags? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What’s stopping us from using custom html tags?

Instead of <div class = ‘intro’> hello world </div> <main class = ‘content’> </main> … <intro> hello world </intro> <con> </con> So far it works, so why don’t I see many websites using it or people doing something like that?

9th Aug 2021, 3:43 AM
Ginfio
Ginfio - avatar
3 Answers
+ 2
in every industry there is a kind of best practice, or conventional habits as you wish. And it is very hard to break developed habit as you know, whether it personal or industrial. Must be huge motivation and wish of masses. And until great bunch of percentage of people involved in given industry are happy enough with the situation, nothing will change. Further more, they will stay against any change. Hope you got the point.
9th Aug 2021, 4:21 AM
Shadoff
Shadoff - avatar
+ 1
Shadoff yes. I see wha you r saying. But, Im wondering if it has to do .. like maybe if some browsers aren’t supporting it such unknown tags for some reason, or somethn like that.
9th Aug 2021, 4:57 AM
Ginfio
Ginfio - avatar
+ 1
Html allows you to use custom tag, add functionality with HTMLElement class. The custom tag must be named with - hyphen letter between letters. eg. x-header, don't use data-name since data-* is reserved for data attribute. https://code.sololearn.com/WWz6of1RuvOH/?ref=app Other custom tag although it might work with CSS even JavaScript, but is not advisable to use, since its behaviour in browsers can be completely arbitrary.
10th Sep 2021, 11:48 PM
Calviղ
Calviղ - avatar