What is the real difference between HTML4.0 and XHTML1.0?

Source: Internet
Author: User
Tags compact lowercase


Documents must be well organized
XHTML is an application of XML. Some of the habits that are completely valid in SGML-based HTML 4 must be changed in XHTML. Well-formedness is a new concept introduced in [XML. Essentially, this means that the element must have an end tag or be written in a special way (as described below ).
Elements must be nested. Although SGML requires that the stack is illegal, existing browsers generally allow the stack.
Correct: nested element.
<P> here is an emphasized <em> paragraph </em>. </p>
Incorrect: stacked element.
<P> here is an emphasized <em> paragraph. </p> </em>
The element and attribute names must be in lowercase.
For all HTML elements and attribute names, the XHTML document must be in lowercase.
Because XML is case sensitive, this difference is required. For example, <li> and <LI> are different labels.
The end label must be used for non-empty elements.
In SGML-based HTML 4, some elements with an implicit ending meaning can ignore the ending label. In XML-based XHTML, this type of ignore is not allowed. All elements except the elements declared as null in the DTD must have an end tag.
Correct: The end element.
<P> here is a paragraph. </p> <p> here is another paragraph. </p>
Incorrect: The element is not ended.
<P> here is a paragraph. <p> here is another paragraph.
The property value must be enclosed in quotation marks.
All attributes must be enclosed in quotation marks, even numbers.
Correct: attribute value in quotation marks
<Table rows = "3">
Incorrect: The attribute value is not in quotation marks.
<Table rows = 3>
Minimize attributes
XML does not support attribute minimization. Attribute value pairs must be fully written. Attribute names such as compact and checked can appear in elements without specifying attribute values.
Correct: the attribute is not minimized.
<Dl compact = "compact">
Incorrect: The attribute is minimized.
<Dl compact>
Empty element
An empty element must either have an end tag, or the start tag must end with a/>. for example, <br/> or

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.