在本文中,我们将看到 HTML 中的空标签,我们还将重点介绍使用空标签的目的。空元素是没有任何嵌入元素或文本元素的组件。空元素没有后继节点。换句话说,不包含任何结束标签的标签是空标签。空标签仅包含开始标签,但它们在网页中执行某些操作。
句法:
没有封闭标记的元素称为空元素。将结束标记添加到空元素将是无效的语法。空元素没有任何子节点。简而言之,Empty 元素是自关闭或无效的,而不是容器标签。空元素用于嵌入图像、列表、中断、水平线、超链接、用于输入、元数据、区域等。例如,
标签有一个结束标签,因此它不是一个空元素。
以下是在 HTML 中使用的空元素列表:
Elements |
Description |
---|---|
It is used to map a portion of an image to make it clickable by the end-user. It is used to direct the user to different links after the user clicks on the mapped portions of the image. It is used as a child tag of the |
|
For all relative URLs in a document, the base URL is specified to use with the |
|
The |
|
The |
|
The |
|
A thematic break between paragraph-level components is represented by the element. For instance, a change of shift in the topic within a section. |
|
The element is used to embed an image into the document. |
|
This empty element is used to create interactive controls for web-based applications and forms, for accepting the information from the user such as an address, name, phone number, etc, depending on a variety of types of input data and control widgets are available. All the input types and attributes are used inside the element. |
|
The HTML element is used to establish a connection between the current content and an external resource. For instance, we can use it to link the external stylesheet or javascript file, etc. |
|
The HTML element represents metadata i.e., information of a information. |
|
The tag in HTML is used to define a parameter for plug-ins which is associated with |
|
The |
|
The |
|
The |
下面的代码示例说明了空元素的使用。我们在这里只使用了其中的几个。
例子:
HTML
Empty Element
br tag
5th Floor, A-118,
Sector-136, Noida,
Uttar Pradesh - 201305
hr tag
col tag
Sr. no
Title
Price
1234
GeeksForGeeks
$10
img tag
input tag
输出: