First, to build a basic document structure
1. DOCTYPE elements
<! DOCTYPE html>
Tell the browser: (1) It handles HTML documents, (2) The version of HTML that is used to mark the contents of the document, but the version number is not written.
2. HTML elements
The root element that represents the beginning of the HTML portion of the document
3. Head element
(1) contains the metadata for the document, which provides the browser with information about the contents and tags of the document, and also includes scripts and references to external resources.
(2) must contain the TITLE element
4. BODY element
Contains the contents of a document
Ii. document with metadata elements
1. Title Element
(1) Set the title or name of the document
(2) Each HTML document should have only one TITLE element
2. Base element
(1) can be used to set a base URL, so that the relative links in the HTML document on this basis for parsing; HTML document contains at least one base element
(2) Properties: href, target
3. Meta elements
(1) Used to define various metadata in the document. It has many different uses, and an HTML document can contain multiple meat elements.
(2) Specify name/value metadata pairs: The Name property is used to represent the type of metadata, and the content property is used to provide a value
<meta name = "Author" content = "WGX"/>
(3) Declaration character encoding: CharSet property
<meta charset = "Utf-8"/>
(4) Analog HTTP header field: Http-equrv property specifies the header field name to impersonate, the Content property specifies the field value
<meta http-equrv = "Refresh" content = "5"/>
4. Style element
(1) Type property: Specifies the style type, and the value is always text/css
(2) Scoped property: Specifies the scope of the style, and if the attribute exists, the style defined in it only acts on the element's parent element and all sibling elements
(3) Media properties: Specify the appropriate style
5. LINK element
(1) Used to establish a connection between HTML documents and external resources, most typically CSS style sheets
(2) Rel attribute: Description of the relationship type of the document to the associated resource
(3) HREF attribute: Specifies the URL of the resource to which the link element points
(4) Type attribute: Specifies the MIME type of the associated resource, such as TEXT/CSS, Image/x-icon
(5) Media properties: Description of the associated content for that device
(6) Sizes Property: Specifies the size of the icon
(7) Hreflang attribute: Describes the language used by the associated resource
6. Script Element
(1) for defining scripts and controlling their execution
(2) Define inline script: No type attribute is allowed, default is JavaScript
(3) Loading external script: there should be no embedded script in the tag
(4) Deferred script execution: The Defer property defines whether the script will be deferred until the document has been parsed, which is not useful for inline scripting
(5) Execute script asynchronously: The Async property indicates whether the browser executes the script asynchronously if allowed, which is not useful for inline scripting
7. NoScript elements
(1) To display some content to users who have disabled JavaScript or browsers that do not support JavaScript
(2) Purpose: 1, display content that does not require JavaScript, and tell users to enable JavaScript to display
2. When the browser does not support JavaScript, it will be led to another URL, you need to add a META element
Create an HTML document