HTML documents are text files that are composed of HTML elements.
HTML elements are defined by using HTML tags.
HTML Tags
-
- HTML tags are used to tag HTML elements .
- HTML tags are surrounded by < and > symbols , which are called angle brackets.
- HTML tags appear in pairs . such as <b> and </b>.
- The text that is between the start and end tags is the content of the element.
- The HTML tag is not sensitive to case ,<b> and the role of <B> is the same.
HTML elements
Do you remember the example in the previous section:
<HTML><Head><title>Title of the page</title></Head><Body><P>This is my first page.</P><b>This text is in bold.</b></Body></HTML>
This is an HTML element:
< b > This text is bold. </ b >
This HTML element starts with the start tag <b> .
The content of this element is: "This text is bold. ”。
This HTML element is terminated by the tag </b> end.
The function of the <b> tag is to define an HTML element that is displayed in bold.
This is also an HTML document:
< Body > < P > This is my first page. </ P > < b > This text is bold. </ b > </ Body >
This HTML element starts with the <body> tag and ends with the </body> tag.
The function of the <body> tag is to define the HTML element that holds the body in the HTML file.
Why should we use lowercase tags?
We just talked about: the HTML tag is insensitive to case:<b> and the same as <B> 's role. When you surf the Web, you'll find that most tutorials use uppercase HTML tags in their examples. And we always use lowercase. What is the reason?
If you want to be prepared to use next-generation HTML, you should use lowercase tags. The World Wide Web Consortium has the following criteria: It is recommended to use lowercase tags in html 4, whereas in XHTML (Next generation HTML), lowercase tags must be used.