HTML tags

What are tags

Tags are the above < head>, < body>, < table>, etc. enclosed by angle brackets "<" Most tags for objects wrapped with ">" appear in pairs, such as < table>< /talbe>, < form>< /form>. The first tag in the tag pair is the start tag, and the second tag is the end tag. The start and end tags are also called open tags and closing tags; of course, there are a few that do not appear in pairs, such as < br> , < hr>, etc. Tags are used to mark HTML elements. The text between the start tag and the end tag is the content of the HTML element.

Introduce what elements are in advance (comparison)

Many people may not understand the concept of which is called a label and which is called an element. I have been confused since I learned it. In order to avoid such a tragedy from happening again, I will make a distinction here in advance. In fact, the concept between the two is still very clear.

HTML web pages are actually composed of many various HTML elements. text files, and any web browser can run HTML files directly. So it can be said that HTML elements are the basic objects that constitute HTML files, and HTML elements can be said to be a general term. HTML elements are defined using HTML tags.

For example,< p>This is a tag;< p>Content< /p>This is an element, which means that the element consists of a starting tag and an ending tag, used to contain a certain There is some content; there is one notable exception here, which is that < br/> itself is both a start and end tag, but contains no content, so it is just a tag.

We will have specific chapters to describe elements later, but we will briefly mention them here to avoid confusion about concepts and labels.

Commonly used tags

We know that web pages can achieve various customizations and realize various functions, and in turn It can be seen that we have many types of tags, so that various functions and definitions can be realized. Here we will first talk about the four most basic tags

HTML heading Heading is defined through tags such as < h1> - < h6>. Example:

<h1>This is first heading</h1>
<h2>This is second heading</h2>
<h3>This is third heading</h3>

HTML paragraph paragraph is defined through the < p> tag. Example:

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

HTML link Link is defined through the < a> tag. Example:

<a href="http://www.php.cn">This is a link</a>

HTML image image is defined through the <img> tag. Example:

<img src="php.jpg" width="100" height="142" />

Here is just a simple display of four commonly used tags. As for the specific usage methods and other tags, we will describe them in detail in subsequent chapters. One more thing to add here is that HTML tags are not case-sensitive: < P> is equivalent to < p>. Many websites use uppercase HTML tags. W3School uses lowercase tags because lowercase is recommended by the World Wide Web Consortium (W3C) in HTML 4 and will be mandatory in a future version of (X)HTML. Therefore, when writing subsequent tags and attributes, we will all use lowercase letters.

Continuing Learning
||
<h1>This is first heading</h1> <h2>This is second heading</h2> <h3>This is third heading</h3>
submitReset Code