content". Tag names are not case-sensitive, but attribute values ​​need to be case-sensitive; and a small number of HTML tags do not have a separate end tag, but add "/" to the start tag to close it."/> content". Tag names are not case-sensitive, but attribute values ​​need to be case-sensitive; and a small number of HTML tags do not have a separate end tag, but add "/" to the start tag to close it.">

Home  >  Article  >  Web Front-end  >  What three parts does an element in html5 consist of?

What three parts does an element in html5 consist of?

青灯夜游
青灯夜游Original
2022-04-25 12:15:413386browse

The element in HTML5 consists of three parts: start and end tags, content, and attributes. The syntax is "11b50db47abb06abbcce45f495ea478econtent". Tag names are not case-sensitive, but attribute values ​​need to be case-sensitive; and a small number of HTML tags do not have a separate end tag, but add "/" to the start tag to close it.

What three parts does an element in html5 consist of?

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

The tags in HTML are like keywords. Each tag has its own semantics (meaning). For example, the e388a4556c0f65e1904146cc1a846bee tag represents a paragraph, and the a4b561c25d9afb9ac8dc4d70affff419 tag represents bold. Depending on the tag, the browser will display the content in the tag in different ways.

In actual development, sometimes we also refer to HTML tags as HTML elements. The element in

html5 consists of three parts: starting and ending tags, content, and attributes.

Most HTML elements start with a start tag and end with an end tag. A small number of HTML elements do not have a separate end tag and are closed with "/". The content of the

element is the content between the start tag and the end tag.

The name of the tag is not case-sensitive, but the values ​​of most attributes need to be case-sensitive, as shown below:

	  属性
	   ↓
<div class="foo">php中文网</div>
 ↑                  ↑      ↑
开始标签            内容   结束标签

In addition to the class attribute, the start tag can also contain Other attribute information, such as id, title, etc.

Note that although HTML tags are not case-sensitive in syntax, for the sake of standardization and professionalism, it is strongly recommended to always use lowercase when defining tags.

When using a browser to open the HTML document we wrote, the browser will read the content in the document from top to bottom, and render the content in the tag in the browser based on the HTML tags and attributes. in the vessel.

An HTML document must have some basic tags so that the browser can distinguish between ordinary text and HTML documents. You can use any number of tags depending on the effect you want to achieve, but there are a few things to note:

  • All HTML tags must be placed within angle brackets 6d267e5fab17ea8bc578f9e7e5e1570b;

  • Different tags in HTML can achieve different effects;

  • If a certain tag is used, it must be ended with the corresponding closing tag (Except for autism and labels).

Self-closing and tags

Some HTML tags do not have a separate closing tag, but add / in the opening tag to close it. Such labels are called autistic and labelling. Please see the following example:

<img src="/static/images/new/logo.png" alt="php中文网Logo" />  <!-- 图像 -->
<hr />  <!-- 分割线 -->
<br />  <!-- 文本换行 -->
<input type="text" placeholder="请输入内容" />  <!-- 文本输入框 -->

The closing tag does not need to surround the content, so there is no need for a separate closing tag. Only a small number of HTML tags are self-closing.

##19791207a4e0a22c816ac020ecd8cae0 represents HTML comments, which are used to explain HTML code. The browser will ignore the comment content, so users cannot see it in the web page. Go to the comment

[Related recommendations:

html video tutorial, web front-end]

The above is the detailed content of What three parts does an element in html5 consist of?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn