"."/> ".">

Home  >  Article  >  Web Front-end  >  What is parent tag in html5

What is parent tag in html5

WBOY
WBOYOriginal
2022-01-23 15:04:002965browse

In HTML5, when a tag is wrapped by another tag, the wrapped tag is called the parent tag of the wrapped tag; the wrapped tag is called the child tag of the outer wrapping tag, syntax is "33ebfc59ce4f31ed755f706458fd19482d17e6345b7341be57abaa7f5c15e91b7d2aa939a4a42dcd4a4f6b34e6787605dd650dabf5da3b97bc0a99019daa950f".

What is parent tag in html5

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

What is the parent tag in html5

For example:

<div>
<p></p>
</div>

Relative to p, div is its parent tag

Double tag Relationships can be divided into two categories:

Father-child relationship (nested relationship)

The parent-child relationship is to nest other elements within a double label, then the elements nested in it are equivalent to "child ", its outer element is equivalent to "parent".

Brother relationship (parallel relationship)

Brother relationship means that there are multiple parallel elements in the "parent tag", and the relationship between these parallel elements is brotherhood.

Parent element, child element, brother element, descendant element

As you can see from the above parent-child relationship, the element equivalent to "father" is the parent element, and the nested element is the child. Element

If multiple elements are nested, then these multiple elements are brothers of each other.

The descendant elements are the child elements within the child element, and the child elements of the child element are its outer layer. Descendants of the element's parent element

talk is cheap, show you(me) the code

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
    <!-- <div>是<body>的子元素 ,<body>是父元素,<body>和<div>是父子关系-->
        <h1>这是后代元素1</h1>
        <p>这是后代元素2,和后代元素1是兄弟关系,并且互为兄弟元素</p>
    </div>
</body>
</html>

Recommended tutorial: "html video tutorial"

The above is the detailed content of What is parent tag in html5. 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