Summary of HTML interview questions and HTML interview questions
I. What is the significance of the function of doctype in strict and mixed modes?
1. Syntax format: <! DOCTYPE html>
2. <! DOCTYPE> it is not an Html tag, but an instruction that tells the browser which HTML version is used for writing this page.
3. There are three modes in html 4.01:
1. Strict html 4.01 Strict mode, does not contain presentation (Purely display service labels for pages, such as B and font, because these have corresponding alternatives in css.) And deprecated elements, such as font. framesets is not allowed );
2. html 4.01 Transitional filtering mode, including display and discard elements, but not framesets );
3. html 4.01 Frameset loose mode, including display and discard elements, and framesets );
4. There are four modes in xhtml:
1. The xhtml 1.0 Strict mode does not contain display and Discarded tags, framesets, and tags are strictly written in xml format;
2. xhtml 1.0 Transitional filtering mode, including display and discard tags. framesets is not allowed and tags are strictly written in xml format;
3. xhtml 1.0 Frameset loose mode, including display and discard tags, allows framesets, and strictly writes tags in xml format;
4. xhtml 1.1 is equivalent to xhtml 1.0 strict, but the model can be added.
5. Differences between standard mode and hybrid mode
1. These two models are mainly extracted by the browser manufacturer. In standard mode, the browser displays the page according to the specification, while in mixed mode, the browser displays the page in backward compatible mode;
2. Mozilla and Safari use the "almost standard mode", that is, there is a slight difference in the way tables are processed;
3. The biggest problem is the box rendering mechanism of IE. The border-box (weird mode) and content-box modes appear;
6. How to trigger the hybrid mode
1. html 4.01. If the document contains a transitional (filter) DTD but does not have a URI, it will be rendered in a mixed mode;
2. If xhtml or html does not exist <! DOCTYPE> label, rendering in Mixed Mode
Ii. Why does HTML5 only need to be written? <! Doctype html>
The main reason is that there is only one document type in html5, that is, html. Unlike html 4.01 or xhtml1.0, there are multiple document types.
3. In-row elements, block-level elements, and empty elements
1. In-row elements: span, a, em, label, textarea, select, sub, and sup
2. Block-level elements: div, ul, ol, li, h1 ~ H6, table, form, p, dl, dd, dt, etc.
3. Empty elements: br and hr
Iv. Differences between link and @ import
1. Three types of css are referenced on the html page. One is the style label in the page, the other is the link external link, and the third is the @ import.
2. link is an xhtm label, not only external css, but also rss service, while @ import can only be css.
3. Files of link outer links are loaded synchronously with documents, while @ import is loaded only after the documents are loaded.
4. link has no compatibility issues, while @ import is in the css2.1 specification, which is not supported by browsers of earlier versions.
5. link supports controlling DOM element styles using js, but @ import does not (that is, you can use javascript to operate link labels to change css documents to achieve skin replacement effect, @ import does not work)
<style> @import url('test.css'); </style>