The difference between XHTML and HTML

Source: Internet
Author: User

1. XHTML requires proper nesting

Error: <p>xhtml document <strong> main differences from HTML </p></strong>

Correct: <p>xhtml document <strong> main differences from HTML </strong></p>

2. All XHTML elements must be closed

Under the HTML some primitive can be used alone, such as <p> tags, can not write </p>. However, under XHTML, it is required to write a close tag.

Error: The main difference between <p>xhtml and HTML

Correct: The main difference between <p>xhtml and HTML </p>

Some empty elements are written in XHTML with spaces and slashes before ">", such as:

<br/>

3. XHTML is case-sensitive

The HTML is case-insensitive, but is distinguished in XHTML. XHTML all tags and attributes are lowercase. Such as:

Error:

Correct:

4. XHTML attribute values are quoted

Error: <table width=800

Correct: <table width= "800"

Property values can be in double quotes, or single quotes, but paired.

5. XHTML replaces the name attribute with the id attribute

Error:

Correct:

6. Attribute value cannot be shortened

In HTML, some element attribute values have only a single fixed value, so you can write property names without writing property values, but you must write property names and property values in XHTML. Such as:

Error: <input type= "Radio" checked>

Correct: <input type= "Radio" checked= "checked" >

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.