HTML——element

HTML elements
HTML documents are defined by HTML elements.
HTML element
start tag* element content end tag*

<p> 这是一个段落  </p>
<a href="default.htm">  这是一个链接  </a>
<br>         

*The opening tag is often called the opening tag, and the closing tag is often called the closing tag.
HTML element syntax
HTML elements start with an opening tag
HTML elements end with an closing tag The content of an
element is the content between the opening and closing tags
Some HTML elements have empty content
Empty elements are closed in the opening tag (with end of the start tag)
Most HTML elements can have attributes
Note : You will learn more about attributes in the next chapter of this tutorial.
Nested HTML Elements
HTML documents consist of nested HTML elements.
HTML document example

<!DOCTYPE html>
<html>

<body>
<p>这是第一个段落。</p>
</body>

</html>

The above example contains three HTML elements.
HTML instance parsing

<p> 元素:
<p>这是第一个段落。</p>
这个 `<p>` 元素定义了 HTML 文档中的一个段落。
这个元素拥有一个开始标签 <p> 以及一个结束标签 </p>.
元素内容是: 这是第一个段落。
<body> 元素:
<body>
<p>这是第一个段落。</p>
</body>
<body> 元素定义了 HTML 文档的主体。
这个元素拥有一个开始标签 <body> 以及一个结束标签 </body>
元素内容是另一个 HTML 元素(p 元素)。
<html> 元素:
<html>

<body>
<p>这是第一个段落。</p>
</body>

</html>
<html> 元素定义了整个 HTML 文档。

This element has a start tag <html>and an end tag

</html>.

The element content is another HTML element (the body element).
Don't forget the closing tag Most browsers will display the HTML correctly
even if you forget to use the closing tag:

<p>这是一个段落
<p>这是一个段落

The above example will also display fine in the browser because closing the tag is optional.
But don't rely on this practice. Forgetting to use closing tags can produce unpredictable results or errors.
HTML Empty Elements HTML elements with
no content are called empty elements. Empty elements are closed in the opening tag.

<br> 就是没有关闭标签的空元素(<br> 标签定义换行)。

In XHTML, XML, and future versions of HTML, all elements must be closed.
Adding a slash to the opening tag, for example <br />, is the correct way to close empty elements, and is accepted by HTML, XHTML, and XML.
Even though it is valid <br>in all browsers, using <br />it is actually a more long-term guarantee.
HTML Tip: Use Lowercase Tags
HTML tags are not case sensitive: <P> 等同于 <p>。Many websites use uppercase HTML tags.
Because the World Wide Web Consortium (W3C) recommends lowercase in HTML 4, and enforces lowercase in future (X)HTML versions.
HTML basic HTML attributes
Note :
1. For the use of some tags, remember that all tags need to be closed, whether it is a single tag or a pair of tags. (Although the current browser recognizes the case that some tags are not closed, the best way to ensure compatibility is to use closed)
2. The label writing method should use lowercase letters (some versions can consider the case to be the same, but it is mandatory to use in xhtml lower case)

I am weak, so I have to keep working hard!
Work hard because you don't want to disappoint those who care!
It is not easy for bloggers to organize, if you like it, please follow the bloggers!

Bloggers like to make friends. The following is my contact information:
QQ: 1263030049
Please indicate the reason before adding friends. Thank you!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324593597&siteId=291194637