Home > Web Front-end > Front-end Q&A > What does the html web page code begin with?

What does the html web page code begin with?

WBOY
Release: 2022-06-17 15:56:21
Original
7972 people have browsed it

In HTML, the beginning of the web page code is "<!DOCTYPE html>"; this code is the "" statement, which is the document declaration header and is used to describe the HTML used. Which version will be placed at the front of the document code, before the "" tag.

What does the html web page code begin with?

The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.

What does the html web page code begin with?

Document declaration header

For a standard HTML page, the first line is a statement starting with, this is The document declaration header is DocType Declaration, or DTD for short. DTD can tell the browser which HTML or XHTML specification to use.

doctype is the abbreviation of Document Type, which is used to indicate what version of HTML is used. Placed at the top of the document

declares the frontmost position in the document, before the tag. The

declaration is not an HTML tag; it is used to tell the web browser which version of HTML is used for the page.

In HTML 4.01, the declaration needs to reference the DTD (Document Type Declaration) because HTML 4.01 is based on SGML (Standard Generalized Markup Language). DTD specifies the rules of the markup language to ensure that the browser can render the content correctly.

HTML5 is not based on SGML and therefore does not require DTD reference.

Tip: Always add the declaration to your HTML document to ensure the browser knows the document type in advance.

HTML 4.01 specifies three different declarations: Strict, Transitional, and Frameset. Only one type is specified in HTML5:

<!DOCTYPE html>
Copy after login
Copy after login

Examples are as follows:

Common DOCTYPE declaration

HTML 5

<!DOCTYPE html>
Copy after login
Copy after login

HTML 4.01 Strict

This DTD contains all HTML elements and attributes, but does not include presentational or obsolete elements (such as font). Framesets are not allowed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Copy after login

HTML 4.01 Transitional

This DTD contains all HTML elements and attributes, including presentational or obsolete elements (such as font ). Framesets are not allowed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Copy after login

(Learning video sharing: css video tutorial, html video tutorial)

The above is the detailed content of What does the html web page code begin with?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template