Home Web Front-end HTML Tutorial Understand in depth what are the rules for element nesting in HTML?

Understand in depth what are the rules for element nesting in HTML?

Apr 26, 2017 pm 02:57 PM
html nesting rule

This article will give you an in-depth understanding of the rules for HTML element nesting. The following editor will describe it for you

1. HTML tags include block-level elements (block) and inline elements (inline)

1. Block-level elements

are generally used to build website architecture, layout, and carry content... It includes the following tags:

address, blockquote, center, dir, div, dl, dt, dd, fieldset, form, h1~h6, hr, isindex, menu, noframes, noscript, ol, p, pre, table, ul

 2. Inline elements

Generally used in certain details or parts of website content to "emphasize, distinguish styles, superscripts, subscripts, anchor points", etc. The following tags are all embedded elements:

a, abbr, acronym, b, bdo, big, br, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong , sub, sup, textarea, tt, u, var

2. Nesting rules of HTML tags

1. Block elements can contain inline elements or certain block elements, but inline Elements cannot contain block elements, they can only contain other inline elements:

—— Right

  —— Right

 

—— Error

 2. Block-level elements cannot be placed inside

:

 

—— Wrong

 

—— Wrong

 3. There are several special block-level elements that can only contain inline elements and cannot contain block-level elements. These special tags are:

h1, h2, h3, h4, h5, h6, p, dt

 4. li can contain div tags——This item does not need to be listed separately, but many people on the Internet are confused about this, so I will briefly explain it here:

The li and div tags are both containers for loading content. They have equal status and there is no distinction between levels (for example: strict hierarchies such as h1 and h2^_^). You must know that the li tag is connected to its parent ul or ol All can be accommodated.

 5. Block-level elements are juxtaposed with block-level elements, and inline elements are juxtaposed with inline elements:

 

< ;/p>

—— Right

 

 

—— Wrong

The above is the detailed content of Understand in depth what are the rules for element nesting in HTML?. 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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

Rules and exceptions for pointer comparisons? Rules and exceptions for pointer comparisons? Jun 04, 2024 pm 06:01 PM

In C/C++, the pointer comparison rules are as follows: pointers pointing to the same object are equal. Pointers to different objects are not equal. Exception: Pointers to null addresses are equal.

Naming conventions and rules for PHP functions Naming conventions and rules for PHP functions May 19, 2023 am 08:14 AM

As a very popular scripting language, PHP has powerful function library support. Its function naming conventions and rules have an important impact on development efficiency and code readability. This article will introduce the naming conventions and rules of PHP functions. 1. Naming style In PHP, function names need to strictly comply with naming specifications and rules. The specifications mainly include two aspects: naming style and naming rules. 1. Underline nomenclature Underline nomenclature is the most commonly used way to name PHP functions and is also an officially recommended way. Function names that follow this pattern

A deep dive into the definition and specification of Python identifiers A deep dive into the definition and specification of Python identifiers Dec 29, 2023 am 08:34 AM

An in-depth understanding of the definitions and rules of Python identifiers requires specific code examples. Python is a concise and powerful programming language with a wide range of applications. In Python programming, identifiers play a vital role. This article will delve into the definition and rules of Python identifiers and provide specific code examples to help readers better understand and apply them. First, let’s understand the definition of Python identifiers. In Python, an identifier can be the name of a variable, function, class, module, etc.

How to specify in HTML the HTML content of a page to be displayed in an ? How to specify in HTML the HTML content of a page to be displayed in an ? Sep 10, 2023 pm 02:57 PM

In this article, we need to display the HTML content of a page in an iframe; the browser window is divided into separate pages. We can accomplish this using tags and their srcdoc attribute. HTML tag A tag in HTML that specifies an inline frame. The inline frame is used to embed another document within the current HTML document. All browsers support this tag, such as Google Chrome, Microsoft Edge/Internet Explorer, Firefox, Safari and Opera, etc. The "srcdoc" attribute of the tag is used to specify the HTML content to be displayed in the page. This attribute takes HTML_code as value and specifies that it is to be displayed in

Linux firewall-iptables detailed explanation Linux firewall-iptables detailed explanation Feb 20, 2024 am 11:57 AM

Project introduction iptables is a free packet filtering firewall software under Linux system, which can realize packet filtering, packet redirection and network address translation and other functions. It is an efficient and flexible solution that replaces expensive commercial firewalls. iptables has powerful configuration options and rule settings, allowing users to finely control network traffic according to their own needs and improve network security and performance. The rules of iptables actually refer to the conditions predefined by the network administrator. The rules are generally defined as "If the data packet header meets such conditions, process the data packet in this way." The rules are stored in the packet filtering table in the kernel space. These rules respectively specify the source address, destination address, transmission protocol (such as TCP, U

Detailed explanation of the representation methods and rules of character constants in various programming languages Detailed explanation of the representation methods and rules of character constants in various programming languages Dec 27, 2023 am 11:56 AM

How are character constants represented in different programming languages? Introduction: In the programming process, character constants are immutable values ​​that represent a single character. Different programming languages ​​have different ways of representing character constants. This article will introduce the ways to represent character constants in several common programming languages ​​and give specific code examples. 1. C language represents character constants: In C language, character constants are represented by single quotes ('). Here are some examples: Representing a character: chach='a'; Representing an escape character: cha

AI Contract Theory ⑤: Generative AI is racing with thousands of sails, how to use rules to 'steer' AI Contract Theory ⑤: Generative AI is racing with thousands of sails, how to use rules to 'steer' Jun 02, 2023 pm 08:21 PM

21st Century Business Herald reporter Cai Shuyue, Guo Meiting, intern Tan Yanwen, Mai Zihao, reporting from Shanghai and Guangzhou Editor's note: In the past few months of 2023, major companies have rushed to seize large models, explore the commercialization of GPT, and the computing infrastructure has been bullish... Just like 15 In the Age of Discovery that opened in the 20th century, human exchanges, trade, and wealth experienced explosive growth, and the space revolution swept the world. At the same time, change also brings challenges to order, such as data leakage, personal privacy risks, copyright infringement, false information... In addition, the post-humanist crisis brought by AI is already on the table. What attitude should people take? Are you facing the myths caused by the mixture of humans and machines? At this moment, seeking consensus on AI governance and reshaping a new order have become issues faced by all countries. Nancai Compliance Technology Research Institute will launch AI

Detailed explanation of ZKSync airdrop rules: How are ZK tokens distributed? Who is eligible? Detailed explanation of ZKSync airdrop rules: How are ZK tokens distributed? Who is eligible? Jun 14, 2024 pm 10:13 PM

Detailed explanation of ZKSync airdrop rules: How are ZK tokens distributed? Who is eligible? The much-anticipated ZKsync airdrop distribution plan has been finalized. The ZKsync Association will conduct a one-time airdrop of 3.6 billion ZK tokens to early ZKsync users and adopters next week, with 695,232 eligible wallets. The snapshot is on March 24, and community members can check airdrop eligibility on the Claim.zknation.io website and claim airdrops starting next week until January 3, 2025. This airdrop represents 17.5% of the total supply of ZK tokens. Users will be able to claim their tokens starting next week until January 3, 2025. Contributors can claim it starting from June 24th. Who is eligible for

See all articles