1 Basic HTML syntax
1.1 HTML tags
Tags are the basic building blocks of HTML, also known as elements.
Labels are classified into single labels and double labels.
The label name is case insensitive.
<h1>The text content</h1>
<hr>
<hr/>
Copy the code
1.2 Attributes of labels
You can set attributes for HTML tags, and different HTML tags have different attributes.
An HTML tag can set one or more attributes.
An attribute consists of an attribute name and an attribute value, which can be enclosed in single or double quotes or without quotes.
< tag name Attribute name =" attribute value "></ Tag name >Copy the code
1.3 HTML comments
Syntax for comments:
<! -- Comment content -->
<! -- Note 1; Note 1; Note 1 - >
Copy the code
What comments do:
-
Explain the code.
-
Code that does not need to be run for a while can be commented out.
1.4 How to Master an HTML Tag
- The semantics and functionality of tags. The most important thing about a tag is its semantics. Semantic tags help search engines to capture web pages correctly.
- What attributes the tag has and how to set the values of the attributes.
- Whether the label is single label or double label.
1.5 Document Declaration
<! doctypehtml>
Copy the code
Document declarations are used to tell the browser to render the page using standard mode parsing code.
1.6 Basic Page Templates
<! doctypehtml>
<html>
<head>
<meta charset="utf-8">
<title>The page title</title>
</head>
<body>
</body>
</html>
Copy the code
2 SUMMARY of HTML tags
2.1 Main Structure Label
Tag name | Semantics and functionality | attribute | Single label or double label |
---|---|---|---|
html | Root tag | Double label | |
head | Page header | Double label | |
body | Page body | Double label |
2.2 the HEAD tag
Tag name | Semantics and functionality | attribute | Single label or double label |
---|---|---|---|
meta | Set the page meta information Used to set the character set encoding |
Charset attribute:Set a character set encoding. Utf-8 is recommended | single |
title | The page title | double |
2.3 Format Labels
Tag name | Semantics and functionality | attribute | Single label or double label |
---|---|---|---|
h1 ~ h6 | Content title tag | Double label | |
hr | separated | A single tag | |
br | A newline | A single tag | |
p | The paragraph | Double label | |
pre | Displays content in the browser as is Generally used for page-centric code |
Double label | |
div | No semantic label | Double label |