Home  >  Article  >  Web Front-end  >  What are block-level elements and inline block elements?

What are block-level elements and inline block elements?

云罗郡主
云罗郡主Original
2018-11-10 14:28:3813362browse

In the basics of CSS, we often encounter block elements and inline elements. Block elements and inline elements are also very important basic knowledge. Many students feel that it is not important and do not study it. In fact, it is also an incorrect choice. Let's talk about what block-level elements and inline block elements are?

What are block-level elements and inline block elements?

When many students are studying, they find that some elements in the source code are on their own line and are not on the same line as other elements. This means that they are not in the code. It occupies an exclusive line, but occupies an exclusive line in the browser, and some tags are on the same line as other elements, such as the tag. Tags are also called elements. For example, the tag is also called the element. Different people have different names. [Recommended reading: Detailed introduction to div and span html block-level elements in html5

html elements we can use based on the form of expression, Divided into two major categories:

1: Block elements

In many browsers, block elements are displayed occupying one line and exclude other elements and other elements in the On the same line, in the browser, the block element appears as a rectangle and holds other elements.

For example, there are div, and h1~h6, p, hr, ol, ul. These tags should be familiar to each other. Among them, the

and

tags are block tags and occupy a line independently. Any elements in the middle are also excluded from the same line as

and

, while and tags are inline elements.

2: Inline elements

Inline elements are just the opposite of block elements. In browsers, block elements default to one line of other elements. These include strong, em, span, and input. Inline elements can be placed on the same line as other elements and cannot contain block elements, but they can contain other inline elements.

The above is a complete introduction to what block-level elements and inline block elements are. If you want to know more about Html5 tutorial, please pay attention to the php Chinese website.


The above is the detailed content of What are block-level elements and inline block elements?. 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