Differences between HTML and XHTML

Source: Internet
Author: User

1. XHTML elements must be correctly nested

2. The XHTML element must be disabled, and empty labels must also be disabled. For example, <br/>

3. The XHTML element must be in lowercase.

4. The XHTML document must have a root element.

5. The XHTML attribute name must be in lower case, and the attribute value must be enclosed in quotation marks. The attribute name cannot be abbreviated. For example: <input checked = "checked"/>
6. XHTML uses the id attribute instead of the name attribute.

Note: You should add an extra space before the "/" symbol to make your XHTML compatible with today's browsers.

7. The lang attribute is applied to almost all XHTML elements. It defines the type of language used for the content inside the element. If you use the lang attribute in an element, you must add an extra xml: lang, as shown in the following code: <divlang="no" xml:lang="no"> Heia Norge! </Div>

Three XML document types in XHTML 1.0

XHTML 1.0 specifies three types of XML documents to correspond to the above three DTD types.

XHTML 1.0 Strict
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

In this case, a clean mark is required to avoid confusion. Use it with the stacked style sheet.

XHTML 1.0 Transitional
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

In this case: When you need to use HTML's performance features, and you need to write XHTML for browsers that do not support stacked style sheets.

XHTML 1.0 Frameset
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

In this case, you need to use the HTML framework to split the browser window into two or more frames.

Http://www.cnblogs.com/kuyijie/archive/2011/01/06/1927663.html

Related Article

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.