HTML5 Basic Syntax

Source: Internet
Author: User

HTML5 Basic Syntax HTML overviewHypertext

The Web is a collection of hypertext files, which are the basic components of the web, also known as Web pages or HTML documents, Web pages, and so on, typically files with the. HTML or. htm suffix. Web pages are organized together by hyperlinks in hypertext.

What is HTML?

HTML (Hypertext Markup Language): Hypertext Markup Language, a plain text-type language that is interpreted by the browser for execution. Use a "tag" with angle brackets to identify the contents of a Web page. The main purpose of HTML is to design the Web page, the HTML page can be applied to VBScript, JavaScript written program segments.

HTML Base SyntaxMarkup Syntax

The symbols that HTML uses to describe functionality are called "tags", such as <p>,

Enclosing type tag (also called Double mark):

< Mark > content </ tags ><b> This is a B tag </ b >

The enclosing type tag must appear in pairs.

A non-enclosing type tag (also called an empty tag or a single tag).

</> or < tags >

Empty tags are typically used to represent special effects such as:

    • <br>: Line break
    • : Show pictures
Elements

The element is the tag, and the element is the part of each pair of angle brackets, such as the part of <body></body> that is called the BODY element. Elements are like small labels that identify different parts of a Web page document. An element can contain text content and other elements, or it can be empty.

element Nesting

Elements can be nested with each other, but be aware of the nesting order of the tags.

Properties and Values

property is used to decorate the element, and the declaration of the attribute must be in the start tag.

< Tag Attribute declaration location ></ Mark > < Tag Attribute declaration location />

An element may have more than one attribute, separated by a space between multiple properties, and the first attribute to be marked with a space. The precedence is not distinguished between multiple attributes.

<  Properties 2 Properties 3></ tags >

Each property has a value, and the value of the property and property is concatenated with an equal sign, and the value of the property is enclosed in single or double quotation marks.

<align= "center"> paragraph </p> 

Where align is the property name, center is the property value.

Standard Properties

Each element has its own properties, and some are properties that are supported by most elements, known as standard properties or common properties.

    • ID: Defines the unique identity of the element in the page
    • Title: The text that is prompted when the mouse is moved into the current element
    • Class: The name of a referenced style
    • Style: Define inline styles
Notes

Adding the appropriate annotations to your code is a good coding habit, and annotations are visible only in the case of editing the document, which is not displayed when the page is displayed, and the syntax for adding comments is as follows:

<!-- -

Attention:

    1. Nothing between <!--and---is not displayed in the browser
    2. Annotations cannot be nested in other annotations
    3. Note cannot be bit with <>
HTML and XHTML

December 24, 1999, the world's most recommended standard HTML 4.01,xhtml in 2000 January 26 became the world standard.

XHTML is almost identical to HTML 4.01, except that XHTML is a more restrictive version of HTML.

< P > < BR > the paragraphxhtml element must be closed, and the empty tag will be closed < P > < BR > Paragraph
HTML5

The goal of HTML5 is to make the HTML code more concise.

<PAlign= "Rigth">This is a<BR/>Paragraph</P>or<PAlign= "Rigth">This is a<BR>Paragraph</P><inputtype= "text"ReadOnly= "ReadOnly" />or<inputtype= "text"ReadOnly/>

HTML5 no longer demands code format and guarantees compatibility.

Document structurestructure of the HTML document

HTML documents primarily contain document type declarations and HTML pages.

Document Type declaration

Specify the version and style at the beginning of the document with the DOCTYPE declaration, letting the browser know the version, type, and style of the document.

    • Strict DTD
    • Transitional DTD
    • Frameset DTD
    • HTML5

<! DOCTYPE html>

The containing element of the entire document, after the document type declaration of DOCTYPE. The

The

Document Header Content-<title>

Caption elements <title> </title> defines a title for a document, and the caption element has the following characteristics:

    • The content of the title element appears at the top of the browser
    • No attributes
    • Must appear in the
    • A document can have only one header element
Document Header Content-<meta>

Metadata element <meta> is used to define the basic information of a Web page, is an empty tag, commonly used properties are: Content, http-equiv.

<body> Elements

The <body> element appears after the

HTML5 Basic Syntax

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.