Home > Article > Web Front-end > What is html and xhtml
HTML Hypertext Markup Language is a markup-based web design language specifically used to design and edit web pages. XHTML is HTML reshaped to adapt to XML. It is also a markup language. It can be seen as the transition from HTML to XML; XHTML requires that any element that appears in a web page should be marked.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
What is HTML
HTML’s full name in English is Hyper Text Markup Language, which is translated into Chinese as “Hyper Text Markup Language”. It is a A markup web design language specifically used to design and edit web pages.
Hypertext Markup Language is the description language of WWW. It includes a series of tags. These tags can unify the document format on the network and connect scattered Internet resources into a logical whole. HTML text is descriptive text composed of HTML commands. HTML commands can describe text, graphics, animations, sounds, tables, links, etc.
<!DOCTYPE html> <html> <body> <h1>hello world !</h1> </body> </html>
So what does hypertext mean? Hypertext: Pages can contain pictures, links, and even non-text elements such as music and programs. Let’s recall what the role of HTML is in the project. 1. What is certain without thinking is its display function. 2. For any element on the page, we can use JS to make some animation changes to it, whether it is a change in display or a link to other places. In other words, the elements in HTML can be imagined as a portal. With just a click of the mouse, we may get more relevant content. Okay, now imagine that an HTML page is a node, connected to two HTML pages through some kind of trigger. In this way, tens of thousands of HTML pages constitute our World Wide Web.
What is XML
XML is a new language designed to self-describe information. Like HTML, XML is also a text-based markup language, but XML allows users to freely define tags to express document content with practical meaning based on the document they want to express.
What is XHTML
Extensible Hypertext Markup Language XHTML (eXtensible HyperText Markup Language) is the hypertext markup language HTML (HyperText Markup Language) as a standard redefined for XML applications.
XHTML is HTML that has been reshaped to adapt to XML. It is also a markup language; it can be seen as the transition from HTML to XML; XHTML requires that any element that appears in a web page should be marked.
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.
<!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>
The difference between xhtml and html
1. XHTML elements must be nested correctly
Example:
Generally, html web pages can be "a4b561c25d9afb9ac8dc4d70affff4195a8028ccc7a7e27417bff9f05adf5932main content0d36329ec37a2cc24d42c7229b69747a72ac96585ae54b6ae11f849d2649d9e6" This is not strict and is wrong in XHTML; the correct one is The xhtml standard must require such "a4b561c25d9afb9ac8dc4d70affff4195a8028ccc7a7e27417bff9f05adf5932main content72ac96585ae54b6ae11f849d2649d9e60d36329ec37a2cc24d42c7229b69747a".
2. XHTML elements must be closed
exp:
An example in HEAD, "e50dba8e04b6b36f32c78dd59aa7ab95 " Tags like this are feasible in HTML, but for the sake of xhtml standards, they must be closed such as "eb0f68c4f10a97fa4cdfed83e6583d09 "
For example, when using the " e388a4556c0f65e1904146cc1a846bee " line break tag in general HTML, many people just add a " e388a4556c0f65e1904146cc1a846bee " tag to the paragraph that needs to be broken, but in the XHTML CSS standard, it must be like this " < ;p>Paragraph text94b3e26ee717c64999d7867364b1b4a3 ” means that it must start with the line break tag “ e388a4556c0f65e1904146cc1a846bee ” before the article text field, and end with the “ 94b3e26ee717c64999d7867364b1b4a3 ” tag after the paragraph text.
For example, many people use the small line break tag "br" when making html pages. Many people don't know that this tag needs to be wrapped in a closed style. For example: after a paragraph of text, a line break is required. Many CSS productions require line breaks. It would be nice to add a " 0c6dc11e160d3b678d68754cc175188a " here, but let me tell you that this is also non-standard. It will not pass during XHTML verification and must be closed with " df250b2156c434f3390392d09b1c9563 ".
3. Tag names must use lowercase letters
In previous web pages, many tags were usually arranged in uppercase or lowercase letters, but for the sake of WEB standards, tags now require uniform lowercase letters. .
exp:
In the past, many "100db36a723c770d327fc0aef2ce13b1, 6c04bd5ca3fcae76e30b72ad730ca86d" were used in uppercase or mixed case, such as "6a74014ee44f5deb5894267f99b68016, a64997a0904a094b4570728d7f327acd" or "d90fcdb535d6081491edebb07224a674, 9c5594a5fc8d2e506f1a8147102c836b". However, XHTML unified requirements require the use of " 100db36a723c770d327fc0aef2ce13b1, 6c04bd5ca3fcae76e30b72ad730ca86d " in lowercase.
4. The XHTML document must have a root element.
means that any tag that starts with it must be ended with any tag. For example, 6c04bd5ca3fcae76e30b72ad730ca86d must start with the content and end with it. Use 36cc49f0c466276486e50c850b7e4956 to close.
5. You need to add alt attributes to pictures
In the past, when displaying pictures on web pages, you could add or not add alt attributes to the img tag, but now xhtml requires it. Add the alt attribute, otherwise the xhtml verification will prompt an error, even if the alt value is empty.
exp:
Errorb10033f2f65c6d3bc3dbf899e7039e7a
Correctadbbc310db67d34f0c08435e435cc7d8
What are the benefits of adding alt? Answer: Adding alt can provide a text description for the image, allowing search engines to identify the content of the image, which is a good place to optimize web pages.
(Learning video sharing: Getting started with web front-end)
The above is the detailed content of What is html and xhtml. For more information, please follow other related articles on the PHP Chinese website!