Home  >  Article  >  Web Front-end  >  What are the necessary parts of a standard html document?

What are the necessary parts of a standard html document?

青灯夜游
青灯夜游Original
2022-08-31 17:42:334164browse

has 5 necessary parts: 1. DOCTYPE statement, used to tell the browser the version of the markup used to write the page; 2. HTML root element, which contains the metadata of the document and provides the browser with relevant document content. and tag information; 3. Head, which mainly includes encoding declarations, titles, style sheet embeddings, etc.; 4. Title part, used to define the title of the document; 5. Body content part, including all the content of the document.

What are the necessary parts of a standard html document?

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

HTML document is a description of a document. It has a fixed structure and is divided into many parts. Each part contains one or more elements. Some elements are used to describe the basic information of the document, and some describe the document structure. The following is the structure of a basic HTML document:,

<!DOCTYPE html>
<html lang="en">
<head>
 <title>Your page title</title>
</head>
<body>
.....
</body>
</html>

This HTML document describes a blank page. These basic components determine the HTML document. outline and the browser's initial environment.

What are the necessary parts of a standard html document?

You can see the 5 necessary parts of a standard html document.

Declaration part: DOCTYPE statement

DOCTYPE is the abbreviation of document type.

The doctype declaration is not an HTML tag; rather, it is a document type tag, which is an instruction that tells the browser the version of markup in which the page was written.

The doctype declaration is a document type declaration in a standard universal markup language. It is used in web design to indicate what version of XHTML or HTML you are using.

This element tells the browser two things:

  • It processes HTML documents;

  • is used to mark documents The version of the content's HTML. The above writing method indicates that HTML5 is used.

It is very important to specify the doctype in all HTML documents so that the browser understands the expected document type.

Explanation:

  • tag has no closing tag.

  • is not case sensitive.

##Overall analysis: All content

The html element is the root element, which informs browsing The container itself is an HTML document.


tag is the outermost element in an HTML document. The

tag is a container for all other HTML elements (except the tag).

The function of the root element is to tell the browser that the content between and is of HTML type, and the browser will parse the content as HTML. The

html element has three attributes, namely the lang attribute, the xmlns attribute and the manifest attribute: The

  • lang attribute specifies the default language used for page content. Specifying the language in which the document is written helps a language synthesis tool choose a pronunciation language, or a translation tool choose translation rules. For example, means that this document is in Chinese.

  • xmlns attribute assigns the XML namespace. The xmlns attribute is required in XHTML but not in HTML.


  • #The manifest attribute gives the URL of the offline cache file. HTML5 introduces application caching, which means web applications can be cached and accessed offline. For example, means that the offline cache file is waibo.manifest.

##Header:


The head element contains the metadata of the document, which is provided to the browser Provides information about the document's content and markup, and can also contain scripts and references to external resources (such as CSS style sheets).


The various attributes and information of the HTML document are defined in the

element.

Document title: title


The

element is used to define the title of the document; applies to all HTML or XHTML document. <p></p> <title>The role of the element:<p>1. The title can be defined in the browser tab. </p> <p>2. You can provide a title for the page when adding it to favorites. </p> <p>3. The title of the page can be displayed in search engine results. </p> <p>Example:</p><pre class="brush:html;toolbar:false"><!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php中文网</title> </head> <body> <p>正文的内容显示在浏览器窗口中。</p> <p>title元素的内容显示在浏览器标签,收藏夹和搜索引擎结果中。</p> </body> </html></pre><p></p> <p><img src="https://img.php.cn/upload/article/000/000/024/5c18b92ec6088231.jpg" alt="What are the necessary parts of a standard html document?" >##Content:</p>

## The document body contains the content that visitors can see.
After having this basic structure, we can gradually add other elements of HTML later, continuously enrich the document, and finally get the page we want.

Note:

In HTML 5, all special attributes of

have been removed. However, the tag supports standard attributes in HTML 5: ##dirSpecifies elements The text direction of the content. draggableSpecifies whether users are allowed to drag elements. hiddenhiddenSpecifies that this element is irrelevant. Hidden elements will not be displayed. idSpecifies the unique ID of the element. item is used to combine elements. itemprop is used for combined projects. langSpecifies the language code of the content in the element. spellcheckSpecifies whether the element must be Do a spelling or grammar check. styleSpecifies the inline style of the element. subject Specifies the item corresponding to the element. tabindexSpecifies the tab key control order of elements. titleSpecifies additional information about the element.
Attribute Value Description
accesskey character Specifies the keyboard shortcut to access the element
class classname Specifies the element The class name (used to specify the class in the style sheet).
contenteditable
  • true
  • false
Specifies whether users are allowed to edit content.
contextmenu menu_id Specifies the context menu of the element.
data-yourvalue value

Creator-defined properties.

Authors of HTML documents can define their own attributes.

Must start with "data-".

    ltr
  • rtl
    true
  • false
  • auto
id
  • empty
  • url
  • url
  • group value
language_code
    true
  • false
style_definition
id
number
text
Related recommendations: "

html video tutorial"

The above is the detailed content of What are the necessary parts of a standard html document?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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