Home > Web Front-end > CSS Tutorial > What are block level elements in css

What are block level elements in css

王林
Release: 2020-11-30 10:36:30
Original
4050 people have browsed it

The block-level elements in css refer to block elements, and their corresponding inline elements are concepts in the HTML specification. The characteristics of block elements are: 1. Always start on a new line; 2. Line height, height and margins can be controlled; 3. Inline elements and other block elements can be accommodated.

What are block level elements in css

The operating environment of this tutorial: Windows 10 system, CSS3 version. This method is suitable for all brands of computers.

(Learning video sharing: css video tutorial)

Introduction to block-level elements:

Block elements are also known as block-level elements (block elements). Corresponding to it is the inline element, which is a concept in the HTML specification. The basic difference between block elements and inline elements is that block elements generally start on a new line, and adjacent block-level elements will be displayed on different lines. When CSS control is added, this attribute difference between block elements and inline elements no longer becomes a difference.

For example, we can add an attribute such as display:block to the inline element, so that it also has the attribute of starting from a new line every time, that is, it becomes a block element. Similarly, we can add display: to the block element. Attributes like inline allow it to be arranged on one line.

Characteristics of block elements

1. Always starts on a new line;

2. Height, line height, outer margins and inner margins can all be controlled;

3. The default width is 100% of its container, unless a width is set.

4. It can accommodate inline elements and other block elements

Related recommendations: CSS tutorial

The above is the detailed content of What are block level elements in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template