2.html5's basic format, 2.html 5 format

Source: Internet
Author: User

2.html5's basic format, 2.html 5 format

After sharing the core of the html language, it is time to start writing. Theoretically, it can be written in Notepad as long as it meets the format requirements. However, this kind of tough and low productivity behavior is still less well done. Choosing an IDE that suits you is the best choice. As for which one is the right one, you have to try it on your own, HBuilder is used here.

Html documents created using IDE will automatically complete the basic format, but you still need to know the specific format in a learning attitude.

First, the standard html5 document format is as follows:

<! DOCTYPE html> // file type declaration, case insensitive, mainly to tell the browser the current document type 

 

  1. Doctype, document type declaration

Document Type Declaration (Doctype ). It mainly tells the browser the type of the file to be viewed. In the past HTML4.01 and XHTML1.0, it represents the specific HTML Version and style. Currently, HTML5 does not need to express versions and styles.

<! DOCTYPE html>

Of course, the explanation here is an official statement, which is similar to the interpreter declaration at the beginning of the script language.

 

#! /Usr/bin/env python // python declaration #! /Usr/bin/env bash // bash Declaration

If you read my previous article, you will find that my understanding of the html language is to understand it as a scripting language. No way, I learned python and shell first, both are scripting languages, so I am also deeply influenced by their thinking.

 

  2.html Element

First, the element is the meaning of the tag, and the html element is the html Tag. Html elements are the elements at the beginning and end of a document. It is a dual-label that echoes the head and tail and contains the content. This element has an attribute and value: lang = "zh-cn", indicating that the document uses the simplified Chinese language.

<Html lang = "zh-cn"> // en

The above is a very official explanation. Here I would like to add one point,Even if you do not set anything here, it will not affect your use of Chinese on the page..

  3. head Element

It is used to contain metadata, including <link>, <meta>, <noscript>, <script>, <style>, and <title>. The content is used by the browser to provide information, such as CSS information provided by link, JavaScript Information provided by script, and page title provided by title.

<Head>... 

 

  4. meta Element

This element is used to provide information about the document. The starting structure has the attribute charset = "utf8 ". Indicates the encoding used by the browser page. In general, utf8 is used. Of course, the file is also utf8 when it is saved, and the browser also sets utf8 to correctly display Chinese characters.

<Meta charset = "UTF-8"> // besides encoding

 

 

  5. title Element

This element is simple, as its name implies: Set the title in the upper left corner of the browser.

<Title> title </title>

 

 

  6. What is an element?

An element is a group of labels that tell the browser how to handle some content. Each element has a keyword. For example, <body>, <title>, and <meta> are all elements. Different tag names indicate different meanings, including section tags, text tags, link tags, and image tags. There are two types of elements: single tag (empty element) and double tag. A single tag is generally used to declare or insert an element. For example, you can use <meta> to declare character encoding and to insert an image. Dual tags are generally used to set the content of a region, include it, such as a paragraph <p>... </p>.

  7. What are attributes and attribute values?

In addition to single and double elements, attributes and values can be set inside the element. These attribute values are used to change the behavior of elements in some aspects. For example, a hyperlink: The href attribute in <a>, which replaces the URL to link to different websites. Of course, multiple attributes or even custom attributes can be set in an element.

 

  There are not many specific explanations here, so most of them refer to others' content.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.