Understanding block elements in HTML


In the previous article, Taimienphi.vn introduced you to lists (lists) in HTML. The next article below Taimienphi.vn will introduce you more about the block element in HTML.


HTML elements are classified into 2 categories: Block Element (block element) and Inline Element (inline element). Refer to the following article of Taimienphi.vn to find out the block element in HTML.

Block elements in HTML

Table of Contents:
1. Block element in HTML
1.1. Block Element in HTML
1.2. Inline Element in HTML
1.3. Element (div) in HTML
1.4 The element (Span) in HTML
2. Summary

1. Block element in HTML

1.1 Block Element in HTML

A block element usually starts on the new line and takes up the entire available width.
Element div is a block element.
For example: The following example illustrates the block element in HTML:

phan tu block in html

The result returned after applying the block element has the following form:

phan tu block in html 2

Here is a list of block elements in HTML:

phan tu block in html 3

1.2 Inline Element in HTML

Inline Element in HTML does not start with a new line and only occupies a sufficient width.
For example: Refer to the following example to learn about inline elements in HTML:

phan tu block in html 4

The result returned after applying the inline element has the following form:

phan tu block in html 5

The following is a list of inline elements in HTML:

phan tu block in html 6

1.3 The div element in HTML

Element div HTML is often used to contain other HTML elements.
Element div Does not require attributes, however style, class and id are common attributes.
When used with CSS, elements div can be used to specify the type of block for the content.
For example: Refer to the example illustrated below to easily visualize the element div in HTML:

phan tu block in html 7

Results returned after the element is applied div Look like this:

phan tu block in html 8

1.4 The span element is in HTML

Molecules span in HTML is often used as an element containing text (text).
Element span Does not require attributes, however style, class and id are common attributes.
When used with CSS, elements span can be used to specify styles for portions of text.
For example: The following is an example to illustrate the element span in HTML:phan tu block in html 9

Results returned after the element is applied span Look like this:

phan tu block in html 10

2. Summary

Below is a list of the tags in the HTML:

phan tu block in html 11

https://thuthuat.taimienphi.vn/phan-tu-block-rong-html-50635n.aspx
The above article Taimienphi.vn has just introduced you to the block element (block) in HTML. In addition, if you have any questions or questions, you can leave your comments in the comment section below the article to get a better description and learn HTML. In the next articles, Taimienphi.vn will introduce you further class attributes in HTML Please.

.

Add a Comment

Your email address will not be published. Required fields are marked *