+ 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?
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.
+ 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.
+ 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.