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">
Strict:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Framework:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
xhtml:
Transitional:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Frame type:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
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!