html如何处理重叠标签? [英] How does html handle overlapping tags?

查看:271
本文介绍了html如何处理重叠标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

 < b> Hello< i>那里< / b>朋友< / i> 

HTML可以处理重叠的标签,就像例子中所示的那样

解决方案

HTML通过简单地禁止语法来处理问题。它是无效的。



浏览器有错误恢复策略,但您不应该瞄准触发它们。

HTML 5有非规范 此案例的错误恢复策略



跟随它的浏览器将解析:


 < b> Hello< i>那里< / b>朋友< / i> 


好像是

 < b> Hello< i>那里< / i>< / b>< i>朋友< / i> 


For example:

<b>Hello <i>there </b>friend</i>

Can html handle overlapping tags, like shown in the example?

解决方案

HTML handles the problem by simply forbidding the syntax. It is invalid.

Browsers have error recovery strategies, but you shouldn't aim to trigger them.

HTML 5 has a non-normative error recovery strategy for this case.

Browsers that follow it would parse:

<b>Hello <i>there </b>friend</i>

as if it were

<b>Hello <i>there </i></b><i>friend</i>

这篇关于html如何处理重叠标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆