Home > Web Front-end > HTML Tutorial > What is the difference between HTML and XHTML

What is the difference between HTML and XHTML

青灯夜游
Release: 2018-11-30 09:12:27
Original
19302 people have browsed it

Today I will introduce to you what HTML and XHTML are? Let everyone have a certain understanding of HTML and XHTML and know the difference between them. Let's take a look at HTML and XHTML.

What is the difference between HTML and XHTML

What is HTML?

HTML is the acronym for Hyper Text Markup Language (Hyper Text Markup Language), so what is hypertext? What is a markup language?

Hypertext: Hypertext simply means “text within text”. There are links in the text, which is hypertext. Every time you click a link to open a new web page, you do so by clicking on a piece of hypertext.

Markup language: Markup language is a programming language used to make text more interactive and dynamic. It can convert text into images, tables, links, etc.

Example:

<!DOCTYPE html>
<html>
<body>
	<h1>hello world !</h1>
</body>
</html>
Copy after login

Rendering:

What is the difference between HTML and XHTML

What is XHTML?

XHTML stands for Extensible Hypertext Markup Language. It is a cross between HTML and XML languages.

XHTML is almost the same as HTML, but it is more strict than HTML. XHTML is HTML defined as XML application. It is supported by all major browsers.

Example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   >
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
  <title>标题</title>  
</head>  
<body>  
  <h1>XHTML</h1>
</body>  
</html>
Copy after login

Rendering:

What is the difference between HTML and XHTML

##The difference between HTML and XHTML

Although XHTML is almost the same as HTML, it is more important to create the code correctly because XHTML is stricter than HTML in terms of syntax and case sensitivity. XHTML documents are well-formed and parsed using standard XML parsers, unlike HTML which requires a loose HTML-specific parser.

In general, compared with HTML, XHTML has undergone some changes and has some differences. These changes can be divided into three parts:

Changes in document structure

1. All files must have DOCTYPE.

2. The xmlns attribute in is required, and the xml namespace must be specified for the document.

3, , , and are required for their respective closing tags.

Changes in XHTML tags

1. All XHTML tags must be lowercase.

2. All XHTML tags must be ended, that is, the > tag must be ended. Example:

,
, What is the difference between HTML and XHTML

3. All XHTML tags must be nested correctly, and the nesting order of tags must be correct.

4. XHTML documents must have a root element.

Changes in XHTML attributes

1. All XHTML attributes must be added correctly.

2. All XHTML attributes must be lowercase and must be enclosed in quotation marks.

2. XHTML attributes cannot be abbreviated.

3. The XHTML attribute value must be quoted.

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

The above is the detailed content of What is the difference between HTML and XHTML. 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