HTML and HTML5 key points and interview questions

Time:2021-3-3

HTML&&HTML5
1. Semantic words
The new tags of HTML5, such as header, footer, section and so on, are semantic
Benefits:

1. It can make the computer read your content more intuitively and process the message efficiently, which is also good for the search engine
2. It's also good for teamwork, and other team members can understand the meaning of your label more intuitively
3. It is good for SEO to establish a good communication with search engine, and it is helpful to capture more effective information through crawler, because crawler depends on tag, which determines the context and the weight of each keyword through tag
4. It is helpful for development and maintenance, because the W3C compliant teams follow this label, which can reduce the differentiation and make it more semantic and readable
5. Facilitate the analysis of other devices
New features of HTML5:
1. New DOCTYPE statement: <! DOCTYPE HTML >
In html4.01, you need to use DTD, because html4.01 is based on SGML, and DTD specifies the rules of markup language
2. CSS3 is fully supported
3. Video & & audio element
4. One more canvas element for drawing
5. For local offline storage, local storage and session storage
6. New special content elements: such as article, footer, header, NAV, section
7. New form controls, such as calendar, date, time, email, URL, search
8. HTML5 has the function of drag and drop
Drag and drop
How to distinguish HTML from HTML5
1. DOCTYPE statement
How many document types does DOCTYPE have
- HTML5 use <! DOCTYPE HTML > to declare
This tag can declare three DTD types: strict version, transitional version and frame based HTML version
- html4.01 specifies three document types: strict, transitional and frameset
XHTML 1.0 specifies three XML document types: strict, transitional and franmeset
Strict mode is used to present web pages that follow the latest tags, while quirks (inclusive mode or hybrid mode) is used to present web pages designed by traditional browsers. Frame mode is specially designed for DTD used in frame page design. The first two frames are not allowed. Strict mode does not contain presentational or outdated elements, such as font, but inclusive mode does
The difference between XHTML and HTML
In fact, html is XHTML without strict regulations
1. XHTML must be nested correctly
2. XHTML elements must be closed. Tags must be used for both non empty tags and empty tags. Empty tags must also be closed, such as HR, Br
3. Tag names and attributes are sensitive to size, so it's better not to use < body >
4. XHTML document must have a root element, all XHTML must be nested in < HTML > root element, and all other elements can have child elements, which must be in pairs and nested in their parent elements
5. All attributes must be enclosed in quotation marks
6. Code all the < and & special symbols
7. Assign a value to all attributes
8. Pictures must have captions
How to distinguish between strict mode and hybrid mode? significance?
1. <! DOCTYPE > at the top of the document, before all labels, states how to render the document
2. Strict mode is run according to the highest standard supported by the browser. For example, it will not support outdated tags and appearance tags
3. In hybrid mode, the page is presented in the form of loose backward compatibility, simulating the behavior of the old browser, preventing the site from working normally
four ⚠ When DOCTYPE does not exist, the document will exist in mixed mode
Webwork and websocket

How to solve the problem that Ajax can’t retreat
Websocket and Ajax polling

How to add spaces to a web page:
&nbsp

How to display code in web page?
1. For single line code, use label
2. For multiple lines of code, use the label < pre > < / pre >