An HTML overview
1. Basic structure of HTML document
Let's take a look at an example of HTML that contains several major HTML tags:
<!DOCTYPE HTML><HTML><Head> <MetaCharSet= "Utf-8"> <title>This is my first HTML</title></Head><Body> <H1>My first title</H1> <P>My first paragraph!</P></Body></HTML>
Brief description:
Chinese web pages need to use <meta charset= "Utf-8" > declaration, otherwise garbled;
DOCTYPE declares the document type, specifies the reference specification for the document, helps to display the Web page correctly in the browser, and the DOCTYPE declaration is not case sensitive;
<body></body> defines the body of the HTML document as the visual content of the Web page;
<p></p> defines a paragraph in an HTML document;
Operation Result:
2. What is HTML?
HTML (Hypertext Markup Language): is a Hypertext Markup Language used to describe web pages, strictly speaking,HTML is not a programming language, but a markup language .
The so-called markup language is composed of a set of tag tags.
HTML uses tag tags to describe web pages, and HTML documents contain HTML tags and text content.
3. What is an HTML document?
HTML document: Contains HTML tags and plain text to describe a Web page.
HTML documents are also called Web pages.
4. What is an HTML tag?
HTML tag tag (HTML tag): is a pair of words surrounded by angle brackets.
The first label in the pair is called the start tag (open tag), and the second tag is called the closing tag (closed label), such as
Syntax format:< tags > content </tags >
Two HTML elements
1. HTML element Concept
HTML documents are defined by HTML elements.
The HTML element is the beginning of the start tag, ending with the end tag, and the content of the element is between the start tag and the end tag.
An element with empty content is called an empty element, that is, an element that has no content, and can be closed in the start tag, such as <br/>.
Most HTML elements can have properties.
2. Nested HTML elements
HTML documents are composed of nested HTML elements.
Take the example above, "<p> This is a paragraph! </p> "As an element, the element has a start tag <p>, element content" This is a paragraph! ", as well as an end tag </p>. The element is nested within the element <body></body> element.
Ps:
In XHTML, XML, and future versions of HTML, all elements must be closed and empty elements adding slashes to the start tag are the correct way to close the element.
HTML tags are not case sensitive, but use lowercase as much as possible, because the World Wide Web Consortium recommends lowercase in HTML4.
Three HTML attributes
Attributes are additional information provided by an HTML element and are generally added to the start tag.
Attribute values should always be enclosed in single or double quotes, and if the attribute value itself contains double quotes, the attribute value needs to be surrounded by single quotes, such as Name= ' Love ' story "Fish."
The property is always in the form of a name/value pair, such as name= "value".
Attribute instance:
<src= "Google. JPG " width=" " height=">
Where the picture file location is specified in the SRC attribute, the size of the picture is set by the width and Height properties.
Property and property values are not case sensitive, it is recommended to use lowercase attribute/property values.
Common Properties:
Property |
Describe |
Class |
Defines one or more class names for an HTML element, with the class name introduced from the style file |
Id |
Defines the unique ID of an element |
Style |
Inline style of the specified element |
Title |
Additional information describing the element (used as a tool strip) |
HTML notes (i) HTML related concepts