HTML Foundation: the basic structure of HTML

Time:2022-7-12

Basic structure of HTML
Hypertext document is divided into document header and document body. In the document header, some necessary definitions are made for this document, and the document body is the various document information to be displayed.
<HTML>

   <HEAD>
Header information
   </HEAD>

   <BODY>
Body of document
   </BODY>

</HTML>

Where <html> is at the outermost layer, which means that the content between the two tags is an HTML document. We will also see that some Humpage omits the <html> tag because HTML or Htm files are HTML documents by default by web browsers< Head> includes the header information of the document, such as the total title of the document. If the header information is not required, this mark can be omitted< The body> mark is generally not omitted, indicating the beginning of the body content.
The following is the source code of a basic hypertext document:

<HTML>
<HEAD>
<title> a simple HTML example </title>
</HEAD>
<BODY>
<CENTER>
<h3> welcome to my homepage </h3>
<BR>
<HR>
<FONT SIZE=2>
This is my first time to make a homepage. No matter what, I will try my best!
</FONT>
</CENTER>
</BODY>
</HTML>

━┓
┃ file header
━┛

━┓
 ┃
 ┃
 ┃
┃ file body
 ┃
 ┃
 ┃
 ┃
━┛

Labels in hypertext

The biggest obstacle we encounter when we just come into contact with hypertext is some sentences enclosed by “<” and “>”. We call them tags, which are used to segment and mark the elements of the text to form the layout, format and colorful pictures of the text.
1. Single label
Some tags are called “single tags” because they can completely express meaning only by using them alone. The syntax of such tags is:
< tag name >
The most commonly used single label is <br>, which means line feed.
2. Double label
Another type of tag is called “double tag”, which is composed of “start tag” and “end tag”, and must be used in pairs. The start tag tells the web browser to perform the function represented by the tag from here, and the end tag tells the web browser to end the function here. A slash (/) before the start tag becomes the end tag. The syntax of this type of tag is:
< tag > content < / tag >
The “content” part is the part to be affected by this mark. For example, if you want to highlight the display of a certain text, put this text in a <em> < /em> tag:
<em> first: </em>
3. Label attribute
Many single tag and double tag start tags can contain some attributes, and their syntax is:
< tag name attribute 1 attribute 2 attribute 3… >
There is no order between the attributes, and the attributes can also be omitted (that is, take the default value). For example, a single mark <hr> means to draw a horizontal line at the current position of the document, generally from the leftmost end of the current line in the window to the rightmost end. With some attributes:
<HR SIZE=3 ALIGN=LEFT WIDTH=”75%”>