Introduction to css block-level elements:
(Learning video sharing: css video tutorial)
According to W3C The above explanation 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:
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.
Common css block-level elements:
address : 地址。 blockquote:块引用。 center:举中对齐块。 dir:目录列表。 div: 常用块级容易,也是CSS layout的主要标签。 dl:定义列表。 fieldset:form控制组。 form:交互表单。 h1– h6:标题。 hr:水平分隔线。 isindex :input prompt。 menu:菜单列表。 noframes:frames可选内容,(对于不支持frame的浏览器显示此区块内容)。 noscript :可选脚本内容(对于不支持script的浏览器显示此内容)。 ol:有序表单。 p: 段落。 pre:格式化文本。 table:表格。 ul:无序列表。
Related recommendations: CSS tutorial
The above is the detailed content of What are the common css block-level elements?. For more information, please follow other related articles on the PHP Chinese website!