Summary of basic HTML interview questions

小云云
Release: 2018-02-23 13:30:56
Original
2383 people have browsed it

This article mainly shares HTML basic interview questions and answers with you, hoping to help everyone.

1 What does DOCTYPE do? How to distinguish between standard mode and mixed mode? What do they mean?

Tells the browser which version of the HTML specification to use to render the document. An absent or incorrectly formed DOCTYPE will cause the HTML document to be rendered in promiscuous mode.
Standards mode runs at the highest standard supported by the browser; in Quirks mode, the page is displayed in a looser backward-compatible way.

2 Why do you only need to writein HTML5?

HTML5 is not based on SGML (Standard Generalized Markup Language), so there is no need to reference DTD (DTD Document Type Definition), but DOCTYPE is needed to standardize browser behavior.

HTML4.01 is based on SGML, so DTD needs to be quoted. In order to tell the browser the document type used by the document, as follows:

3 What are the inline elements? What are block-level elements? What are the void elements?

Inline elements:a span img input select
Block-level elements:p ul ol li dl dt dd h1 p
Empty elements :


4 What is the difference between using link and @import when importing styles on the page?

The same places are all external reference CSS methods. The difference:

  1. link is an xhtml tag. In addition to loading css, you can also define RSS and other others. Transaction; @import belongs to the CSS category and can only load CSS

  2. link When referencing CSS, it is loaded at the same time when the page is loaded; @import needs to be loaded after the page is fully loaded, and @import is The referenced CSS will wait until the CSS file that references it is loaded before loading

  3. link is an xhtml tag, no compatibility issues; @import was proposed in css2.1, a lower version The browser does not support

  4. link. It supports using javascript control to change the style, and @import does not support the

  5. link style. The weight of the style is higher than The weight of @import

  6. import is required when using it in html