After sharing the core of the HTML language, it's time to start writing. In theory, as long as the format requirements are met, even Notepad can be written. However, this kind of egg pain and low productivity behavior is less good, choose a suitable for their own IDE is the best choice, as to which suitable for themselves, it is necessary to try it out, I use the hbuilder.
Using the IDE to create a new HTML document will automatically complete the basic format, but in the spirit of learning, or to know what the specific format is.
First, the format of the standard HTML5 document is as follows:
<!DOCTYPE HTML>//Document type declaration, case-insensitive, mostly tells the browser the current document type<HTML>//Indicates the beginning of the HTML document<Head>//contains document Meta data start<MetaCharSet= "UTF-8">//Declaration character encoding<title></title>//Set document title</Head>//Contains document metadata acceptance<Body>//Represents the beginning of the HTML Content section, which is the visible part</Body>//Indicates the end of the HTML content section</HTML>Represents the end of an HTML document
1.Doctype, document type declaration
Document type declaration (Doc type Declaration, also known as Doctype). It mainly tells the browser what type of file you are viewing. In previous HTML4.01 and XHTML1.0, it represents the specific HTML version and style. And now HTML5 don't need to show the version and style.
<! DOCTYPE html>
Of course, the explanation here is official, and to my own understanding, this is actually similar to the beginning of the scripting language of the interpreter declaration.
# !/usr/bin/env python //python declaration #!/usr/bin/env Bash //bash's statement
If you read my previous article, you will find my understanding of the HTML language as a scripting language to understand, no way, I learned first Python and shell, both are scripting languages, so I also deeply influenced by their thinking.
2.html elements
First, the element is the meaning of the tag, and the HTML element is the HTML tag. HTML elements are the beginning and ending elements of a document. It is a double-label, tail-to-echo, containing content. This element has an attribute and value: lang= "ZH-CN", which indicates that the document is in the language: Simplified Chinese.
<lang= "ZH-CN"> //If English is en
The above is a very official explanation, and here's a little bit more, it doesn't affect your use of Chinese in the page, even if you don't set anything .
3.head elements
Used to contain metadata content, including:<link>, <meta>, <noscript>, <script>, <style>, <title>. This content is used by the browser to provide information, such as link to provide CSS information, script to provide JavaScript information, Title provides page title and so on.
< Head >... </ Head > //This information is not visible on the page
4.meta elements
This element is used to provide information about the document, with a property of the starting structure: charset= "UTF8". Tells the browser page what encoding to use, in general we use UTF8. Of course, when the file is saved is also UTF8, and the browser settings UTF8 can display Chinese correctly .
<charset= "Utf-8"> //In addition to setting the encoding, there are other
5.title elements
This element is simple, as the name implies: Set the title of the upper-left corner of the browser.
< title > titles </title>
6. What is an element
An element is a set of tags that tell the browser how to handle some content. Each element has a keyword, such as <body>, <title>, <meta> are elements. Different label names represent different meanings and will be followed by paragraph labels, text labels, link labels, picture tags, and so on. Elements are generally divided into two categories: single label (empty Element) and double label. Single-label is generally used to declare or insert an element, such as the declaration of character encoding with <meta>, insert a picture with ; double-label is used to set up a section of the content, include it, such as paragraph <p>...</p>.
7. What are property and attribute values
Elements can also be set to properties and values in addition to a single-pair element. These attribute values are used to alter the behavior of certain aspects of an element. For example, the href attribute in hyperlink:<a>, in which a replacement URL can be linked to a different website. Of course, you can set multiple attributes within an element, even custom properties.
There are not many places to be explained here, so most of them refer to other people's content.
Basic format of 2.HTML5