Home > Web Front-end > HTML Tutorial > What are the specific differences between the usage of XHTML and HTML, and how to distinguish them?

What are the specific differences between the usage of XHTML and HTML, and how to distinguish them?

藏色散人
Release: 2018-08-15 16:04:42
Original
2655 people have browsed it

This article mainly introduces to you the difference between xhtml and html. First of all, everyone needs to understand what xhtml and html are? In layman's terms, HTML is Hypertext Markup Language, and

XHTML is Extensible Hypertext Markup Language, a markup language whose expression is similar to Hypertext Markup Language (HTML), but grammatically More stringent.

In terms of inheritance relationship, HTML is an application based on the standard universal markup language and is a very flexible markup language, while XHTML is based on the extensible markup language, which is a standard A subset of the universal markup language. In other words, xhtml is a subset of html.

The following is a summary of their main differences:

1. Document type declaration method

html:

Transitional type:  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Copy after login

Strict:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Copy after login

Framework:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
Copy after login

xhtml:

Transitional:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Copy after login

Strict:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Copy after login

Frame type:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
Copy after login

2. Syntax

XHTML can be considered as the XML version of HTML. In order to comply with XML requirements, XHTML has more stringent syntax requirements.

3. Detailed distinction

XHTML requires correct nesting, all elements must be closed, case-sensitive, attribute values ​​must use double quotes, use the id attribute instead of the name attribute, special characters processing.

The above is about the difference between html and xhtml. I hope it will be helpful for some friends to master the relevant knowledge points of htmlxhtml.

The above is the detailed content of What are the specific differences between the usage of XHTML and HTML, and how to distinguish them?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template