html5 - Why can browsers display undefined tags in HTML documents?
高洛峰
高洛峰 2017-05-16 13:38:43
0
2
642

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?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
曾经蜡笔没有小新

HTML parsing unknown tags into normal tags has many benefits:

  1. For unsupported tags, you can give tips:<video>浏览器不支持</video>

  2. Some new semantic tags, such as <article></article>, can be displayed even if they are not supported

  3. User-defined tags, such as tags defined by Angular and Vue, can still display content when the js file is not loaded

  4. 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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!