Home >Web Front-end >CSS Tutorial >What are the common block elements in CSS?

What are the common block elements in CSS?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-20 18:15:435651browse

The block elements of css are: address, blockquote, dir, div, dl, form, hr, ol, p, pre, table, ul, caption, dd, fieldset, li, legend, noframes, noscript, h1–h6 etc.

What are the common block elements in CSS?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

The definition of css block-level elements

According to the explanation on W3C, it means that block (block-level) elements are displayed on an exclusive line. Its sibling elements must not be on the same line as it (unless out of the document flow). In fact, in layman's terms, block elements are generally container elements for other elements and can accommodate other block elements or inline elements. The most common ones are P and div. To put it simply, the block element is like a four-square box that can hold other four squares and can be presented anywhere on the page.

If you still don’t understand the above definition of css block-level elements, let’s take a look at the three characteristics of css block-level elements:

  • Each block level Each element occupies its own line, and subsequent elements can only appear on another line. Two elements cannot share the same line.

  • The height, width, line height and top and bottom margins of the element can be set.

  • If the width of the element is not set, it defaults to the width of the parent element.

After reading the characteristics of these three css block-level elements, you should now have a better understanding of css elements. Then let’s take a look at css block-level elements. What?

Common css block-level elements:

  • address: address.

  • blockquote: block quote.

  • center: Center alignment block.

  • dir: Directory list.

  • #div: Commonly used block level is easy, and it is also the main tag of CSSlayout.

  • dl: Definition list.

  • fieldset: form control group.

  • form: interactive form.

  • h1–h6: Title.

  • hr: horizontal dividing line.

  • isindex: inputprompt. menu: menu list.

  • noframes: frames optional content, (this block content is displayed for browsers that do not support frames).

  • noscript: Optional script content (displayed for browsers that do not support script).

  • ol: Ordered form.

  • p: Paragraph.

  • pre: Formatted text.

  • table: table.

  • ul: Unordered list.

Recommended learning: css video tutorial

The above is the detailed content of What are the common block elements in CSS?. 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