Skip to content Skip to sidebar Skip to footer

How Does Html Handle Overlapping Tags?

For example: Hello there friend Can html handle overlapping tags, like shown in the example?

Solution 1:

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-normativeerror 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>

Solution 2:

Combining i and b is totally fine, however, you need to make sure to nest them correctly.

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

Post a Comment for "How Does Html Handle Overlapping Tags?"