What are css block-level elements? For some friends who have just learned CSS, they may not understand this issue well. So, in this article, I will introduce to you the definition of css block-level elements, and what are the css block-level elements?
The definition of css block-level elements
According to the explanation on W3C, 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:
1. Each block-level element is unique If it occupies one line, the following elements can only start on another line, and two elements cannot share the same line.
2. The height, width, line height and top and bottom margins of the element can be set.
3. 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, we should now have a better understanding of css elements. Then let’s take a look at what are the css block-level elements?
What are the block-level elements in css?
Common css block-level elements:
address: address. blockquote: block quote. center: Center alignment block. dir: Directory list. div: Commonly used block level is also the main tag of CSS layout. dl: definition list. fieldset: form control group. form: interactive form. h1–h6: Title. hr: horizontal dividing line. isindex: input prompt. |
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. |
The introduction to css block-level elements ends here. The next article will introduce you to What are the css inline elements? The difference between css block-level elements and inline elements.
Related recommendations:
What are inline elements and block-level elements? _html/css_WEB-ITnose
Introduction to CSS block-level elements/inline elements, inheritance and related properties
The above is the detailed content of What is the definition of css block-level elements? What are the css block-level elements?. For more information, please follow other related articles on the PHP Chinese website!