Basic structure of HTML
Hypertext documents are divided into two parts: document header and document body. In the document header, some necessary definitions are made for this document, and in the document body are various document information to be displayed.
Head information
Document body, text part
Where is in the outermost layer, indicating that the content between this pair of tags is an HTML document. We will also see some Hompages omit the tag because .html or .htm files are defaulted by web browsers to be HTML documents. includes the header information of the document, such as the overall title of the document, etc. If no header information is needed, this tag can be omitted. The tag is generally not omitted and indicates the beginning of the text content.
The following is the source code of a basic hypertext document:
A simple HTML example
Welcome to me The homepage of
This is my first time to make a homepage, no matter what, I will try my best to do it well!
━┓
┃File header
━┛
━┓
┃
┃
┃
┃File body
┃
┃
┃
┃
━┛
Tag in hypertext
When I first come into contact with hypertext, the biggest obstacle I encounter is some sentences enclosed by "". We call them tags, which are elements used to divide and mark text to form the layout and text of the text. format and colorful images.
1. Single tag
Certain tags are called "single tags" because they can fully express their meaning when used alone. The syntax of such tags is:
The most commonly used single tag is
, which means line break.
2. Double tags
Another type of tag is called "double tag", which consists of two parts: "start tag" and "end tag" and must be used in pairs. The start tag tells the web browser to start from here. Begins the function represented by this tag, and the tail tag tells the web browser to end the function here. Add a slash (/) before the start tag to become the tail tag. The syntax for this type of tag is:
Contents
标签> The "content" part is the part that will be affected by this pair of tags. For example, if you want to highlight the display of a certain text, put this text in a
tag:
First place:
3. Label attributes
Many single and double tags can contain some attributes within their initial tags. The syntax is:
There is no order among the attributes, and the attributes can also be omitted (that is, take the default value). For example, the single mark
means to draw a horizontal line at the current position of the document, usually from the end of the current line in the window. Draw from the left end all the way to the right end. With some attributes:
The SIZE attribute defines the thickness of the line, and the attribute value is an integer, missing is 1; the ALIGN attribute indicates the alignment, which can be LEFT (left aligned, default value), CENTER (centered), RIGHT (right aligned); the WIDTH attribute defines the line Length, which can be a relative value (consisting of a pair of " "
The percentage enclosed in symbols represents the percentage relative to filling the entire window), or it can also take an absolute value (the number of screen pixels represented by an integer, such as WIDTH=300). The default value is "100%".