Home  >  Article  >  Web Front-end  >  What are the differences between xHTML and HTML tags?

What are the differences between xHTML and HTML tags?

高洛峰
高洛峰Original
2017-02-23 13:42:311105browse
All tags must be lowercase

In XHTML, all tags must be lowercase. The tongue cannot be interspersed with uppercase and lowercase, nor can it be all uppercase. Examples are as follows.
Error:
Correct:

Tags must be in pairs

such as

...

, ...,
...< ;/div> tags, etc., when a tag appears, there must be a corresponding closing tag, both are indispensable, just like parentheses in any programming language.
Error: Hello everyone

is really good
Correct:

Hello everyone

is really good



Summary:

The order of tags must be correct. Tags are from outside to inside, covered layer by layer, so assuming you write div first and then h1, at the end you must write h1 first and then div. Just remember the principle of "first in, last out", the label that pops up first should end last.
error:

hello


Correct:

csdn



All attributes must use double quotes

In XHTML 1.0, it is stipulated that even single quotes cannot be used, so double quotes must be used throughout.
error:
csdn

Correct:
csdn

The use of target="_blank" is not allowed

The target attribute is completely prohibited starting from XHTML1.1. If you want to have the function of opening a new window, you must rewrite it as rel="external" and use JavaScript to achieve this effect. .
error: csdn
Correct: csdnstick your tongue out


For more related articles about the differences between xHTML and HTML tags, please pay attention to PHP Chinese net!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn