①
Document DeclarationFunction: In order for the browser to display HTML files better, you must inform the browser of your file as HTML syntax:<! DOCTYPE html>
- The declaration must be placed in the first line of the HTML document
- Declaration is not an HTML tag
Ii
Coded LabelsIf you do not set the encoding type correctly, garbled characters are displayed when you need to display a character that is not a browser-set encoding type
Workaround:
- Use the <meta/> tag to set the encoding type in the
- The <meta/> element provides meta-information about the page, which contains information about the corresponding HTML, and the client browser or server-side program processes its properties based on this information:
- HTTP-EQUIV, like the HTTP header protocol, will respond to the browser with some useful information that has helped to better display
- Contents (content type), such as content= "text/html"
- CharSet (encoding type), contained in content, such as content= "Text/html;charset=utf-8"
3. Full version <meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
HTML Learning Note 4: Document declarations and coding tags