Home Web Front-end Front-end Q&A What three parts does an element in html5 consist of?

What three parts does an element in html5 consist of?

Apr 25, 2022 pm 12:15 PM
html5

The element in HTML5 consists of three parts: start and end tags, content, and attributes. The syntax is "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.

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

tag represents a paragraph, and the 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>
 ↑                  ↑      ↑
开始标签            内容   结束标签
Copy after login

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 < >;

  • 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="请输入内容" />  <!-- 文本输入框 -->
Copy after login

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.

## 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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles