Today when I was testing the compatibility of the <main>
tag in HTML5, I had a sudden idea and changed "main" to "abcd",
Then I thought that the browser would ignore the style of <abcd>
, but the result was not the case,
It behaves exactly like a normal tag.
I feel very strange, isn’t that XML?
HTML parsing unknown tags into normal tags has many benefits:
For unsupported tags, you can give tips:
<video>浏览器不支持</video>
Some new semantic tags, such as
<article></article>
, can be displayed even if they are not supportedUser-defined tags, such as tags defined by Angular and Vue, can still display content when the js file is not loaded
More inclusive for new tags. You don’t want the new tab to be completely ineffective and unable to display prompts in browsers that don’t support it.
Looking at it this way, it should be weird.
HTML5 supports custom tags.