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 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>
Rendering:
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>
Rendering:
##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, , ,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: ,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!