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

Manually install mysql5.7.10 on Ubuntu

This tutorial shares the process of manually inst...

JS ES new features: Introduction to extension operators

1. Spread Operator The spread operator is three d...

How to modify the master-slave replication options in MySQL online

Preface: The most commonly used architecture of M...

Vue song progress bar sample code

Note that this is not a project created by vue-cl...

Detailed example of removing duplicate data in MySQL

Detailed example of removing duplicate data in My...

Vue+Element UI realizes the encapsulation of drop-down menu

This article example shares the specific code of ...

Solutions to the Problem of Creating XHTML and CSS Web Pages

The solutions to the problems encountered during x...

Modification of time zone problem of MySQL container in Docker

Preface When Ahhang was developing the Springboot...

MySql 5.7.20 installation and configuration of data and my.ini files

1. First download from the official website of My...

Detailed explanation of CSS counter related attributes learning

The CSS counter attribute is supported by almost ...

How to deal with too many Docker logs causing the disk to fill up

I have a server with multiple docker containers d...

How to install Oracle_11g using Docker

Install Oracle_11g with Docker 1. Pull the oracle...

Introduction to the use of HTML element noscript

noscript definition and usage The noscript elemen...

Element table header row height problem solution

Table of contents Preface 1. Cause of the problem...