Why are HTML character entities necessary?

后端 未结 6 1159
挽巷
挽巷 2021-01-04 18:30

Why are HTML character entities necessary? What good are they? I don\'t see the point.

6条回答
  •  离开以前
    2021-01-04 19:05

    You use entities to help the parser distinguish when a character should be represented as HTML, and what you really want to show the user, as HTML will reserve a special set of characters for itself.

    Typing this literally in HTML

    I don't mean it like that

    will cause the "" tag to disappear,

    e.g.

    I don't mean it like that

    as HTML does not have a tag defined as such. In this case, using entities will allow the text to display properly.

    e.g.

    No, really! </sarcasm>

    gives

    No, really!

    as desired.

提交回复
热议问题