Block-level and line-level elements, special characters, and nesting rules in HTML

Block-level and line-level elements, special characters, and nesting rules in HTML

If we introduce the nesting rules of basic HTML web page tags, the first thing we need to talk about is the classification of elements. Elements can be divided into block-level elements and line-level elements. What are block-level elements? It can occupy a single line, and you can set the width and height, the default is 100%; the row-level element is the opposite, its content determines its width and height, and special characters are treated as text.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML block-level, line-level elements, special characters, nesting rules</title>
</head>
<body>
    <!-- Block element: occupies a single line, width and height can be set, default width is 100% -->
    Block elements are divided into text and container types. Text block elements: p, h1-h6
    Container block elements: div, table, tr, td, frame, ul>li, ol, dl, dt, dd (sequence)
    <!-- Row element: does not occupy a single row, width and height depend on the content-->
    Row element: a img input strong em del span
    Special characters: literal br &nbsp hr
</body>
</html>

The nesting rules are summarized as follows:

1. Block elements can be nested within row elements

2. Row elements can be nested within row elements

3. Row elements cannot be nested within block elements

4. Text block elements cannot be nested within block elements

5. Container block elements can nest block elements

The following blog posts on the basic concepts of HTML web pages, the basic structure of HTML web pages, the introduction of HTML basic tags, images, text, hyperlinks, lists, tables, the interactive principles of HTML basic tags, radio buttons, check boxes, drop-down boxes, and the comparison between web page DIV+CSS layout and ifame traditional layout are all the parts of HTML. The main purpose of learning HTML is to understand its semantic nesting rules to build pages. As for the CSS and interactive logic JS of the page, they are the content to be practiced below!

<<:  How to display percentage and the first few percent in MySQL

>>:  How to set the position of the block element in the middle of the window

Recommend

Mysql classic high-level/command line operation (quick) (recommended)

Since I need to learn how to build servers and da...

Solution to failure in connecting to mysql in docker

Scenario: After installing the latest version of ...

How to ensure the overall user experience

Related Articles: Website Design for User Experien...

CSS Viewport Units for Fast Layout

CSS Viewport units have been around for the past ...

Detailed explanation of how to gracefully delete a large table in MySQL

Preface To delete a table, the command that comes...

Alibaba Cloud ESC Server Docker Deployment of Single Node Mysql

1. Download the accelerated version of msyql dock...

4 ways to view processes in LINUX (summary)

A process is a program code that runs in the CPU ...

Web design experience: Make the navigation system thin

<br />When discussing with my friends, I men...

How to quickly deploy Gitlab using Docker

1. Download the gitlab image docker pull gitlab/g...

CentOS server security configuration strategy

Recently, the server has been frequently cracked ...

Detailed explanation of mysql scheduled tasks (event events)

1. Brief introduction of the event An event is a ...

Example of using rem to replace px in vue project

Table of contents tool Install the plugin Add a ....