The difference between HTML and XHTML

Source: Internet
Author: User
Tags closing tag requires

This article focuses on the differences between HTML and XHTML. In simple terms, XHTML can be considered an XML version of HTML, and XHTML syntax requires more rigor to conform to XML requirements.

The following are some of the major differences between XHTML vs. HTML:

XHTML requires proper nesting

XHTML all elements must be closed

XHTML is case sensitive

XHTML attribute values are in double quotes

XHTML replaces the Name property with an id attribute

Processing of XHTML special characters

XHTML requires proper nesting

The following are the correct nesting:

<p> Web Teaching Network <strong> Update speed is the fastest </strong>. </p>

The following are the wrong nesting:

<p> Web Teaching Network <strong> Update speed is the fastest </p></strong>.

XHTML all elements must be closed

In HTML, such as <p>,<li> tags, you may not write </p>,</li>, but in XHTML, you must require a write-close tag (Closing tag).

Like what:

<p> Web Teaching network is very serious.

should be written:

<p > Web Teaching Network is very serious. </p>

Handling empty elements

Some empty elements, written in XHTML, are preceded by spaces and slashes before ">". such as <br>, should be written <br/>.

The following is an example of an empty element:

<br />

<link rel="stylesheet" href="/styles/webjx.css" type ="text/css" />

<meta http-equiv="content -type" content="text/html; charset=UTF-8" / >

XHTML is case sensitive

HTML is case-insensitive, but XHTML is case-sensitive.

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.