The difference between XHTML and HTML

Source: Internet
Author: User
Tags closing tag dashed line

HTML compared to HTML
1. All marks must have a corresponding closing tag
Previously in HTML, you could open many tags, such as <li> without necessarily writing the corresponding
and </li> to close them. But it's not legal in XHTML. XHTML requires a rigorous structure, and all tags must be closed. If the label is not paired individually, close it by adding a "/" to the label at the end. For example:

2. The names of all the elements and attributes of the tag must be in lowercase
Unlike HTML, XHTML is sensitive to capitalization,<title> and <TITLE> are different labels. XHTML requires that all labels and attribute names must be lowercase. For example:<body> must be written in <body>. Uppercase and lowercase inclusions are also not recognized, and typically Dreamweaver automatically generates attribute names "OnMouseOver" that must also be modified to "OnMouseOver".
3. All XML tags must be properly nested
Also because XHTML requires a rigorous structure, all of the nesting must be in order, as we have previously written code:
<b>
</b>
Must be modified to:
That is, a layer of nesting must be strictly symmetric.
4. All attributes must be enclosed in quotation marks ""
In HTML, you don't need to quote attribute values, but in XHTML they must be quoted. For example:
Must be modified to:
In special cases, you need to use double quotes in the attribute values, you can use ", single quotes can be used," for example:
<alt= "Say ' Hello '" >
5. Encode all < and & special symbols
Any less than sign (<), not part of the label, must be encoded as & L T;
Any greater than sign (>), not part of the label, must be encoded as & G T;
Any number (&), not part of the entity, must be encoded as & a M p;
Note: There are no spaces between the above characters.
6. Assign a value to all attributes
XHTML specifies that all properties must have a value, repeating itself without a value. For example:
<input type= "checkbox" name= "Shirt" value= "Medium" checked>
Must be modified to:
<input type= "checkbox" name= "Shirt" value= "Medium" checked= "checked" >
7. Do not make "--" in the comment content
"--" can only occur at the beginning and end of XHTML annotations, i.e. they are no longer valid in content. For example, the following code is invalid:
<!--here is the comment-----------here is the comment--
Replace the inner dashed line with an equal sign or a space.
<!--here is the note ============ here is the comment--
Some of these specifications look strange, but all of this is to make our code a uniform, unique standard for future data reuse.
8. Pictures must have explanatory text
Each picture label must have alt explanatory text.

Current specifications for XHTML
1. XHTML 1.0 Transitional-Transition type, the identity syntax requirements are more lenient
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Requires a very liberal DTD, which allows you to continue using the HTML4.01 's identity (but to conform to XHTML notation).
2. XHTML 1.0 Strict-Strict type, identifies all changes that require the above XHTML to be compared to HTML
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
Requires strict DTD, you cannot use any of the presentation layer's identities and attributes, such as

3. XHTML 1.0 Frameset-Frameset Definition
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >
DTD used specifically for frame page design, if your page contains frames, you need to use this DTD
4. XHTML 1.1-Modular XHTML
5. XHTML 2.0-Fully modular and customizable XHTML, under development, reference http://w3.org/

The difference between XHTML and HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.