CSS block and inline elements

According to the provisions of the CSS specification, each web page element has a display property, which is used to determine the type of the element. Each element has a default display property value, such as a div element, whose default display property value is "block". Become a "block-level" element (block-level); the default display attribute value of the span element is "inline", which is called "inline" element.

Block-level elements such as div will automatically occupy a certain rectangular space, and the appearance of this rectangle can be adjusted by setting attributes such as height, width, and inner and outer margins; on the contrary, in-line elements such as "span" and "a" Element does not have its own independent space. It exists depending on other block-level elements. Therefore, it is invalid to set attributes such as height, width, and inner and outer margins for inline elements.

Inline element (inline element) Inline element (inline element)

* a - anchor point
* abbr - abbreviation
* acronym - first word
* b - bold (not recommended)
* bdo - bidi override
* big - big font
* br - line break
* cite - citation
* code - computer code (in citing source code *
dfn - define field
* em - emphasis
* font - font setting (not recommended)
* i - italic
* img - image
* input - input box
* kbd - define keyboard text
* label - table label
* q - short reference
* s - dash (not recommended)
* samp - define example computer code
* select - item selection
* small - small font text
* span - common inline container, define block within text
* strike - dash
* strong - bold emphasis
* sub - subscript
* sup - superscript
* textarea - multi-line text input box
* tt - teletext
* u - underline
* var - define variable

Block element (block element)

* address - address
* blockquote - block quote
* center - align block in the lift
* dir - directory list
* div - common block level is easy, but also the main label of css layout
* dl - definition list
* fieldset - form control group
* form - interactive form
* h1 - large heading
* h2 - subheading
* h3 - heading level 3
* h4 - heading level 4
* h5 - heading level 5
* h6 - heading level 6
* hr - horizontal divider
* isindex - input prompt
* menu - menu list
* noframes - optional content of frames, (display this block content for browsers that do not support frames
* noscript - ) optional script content (display this content for browsers that do not support script)
* ol - Sort form
* p - paragraph
* pre - formatted text
* table - table
* ul - unsorted list

Variable Elements
A variable element is a block element or an inline element depending on the context.

* applet - java applet
* button - 按钮
* del - 删除文本
* iframe - inline frame
* ins - 插入的文本
* map - 图片区块(map)
* object - object对象
* script - 客户端脚本

在标准文档流里面,块级元素具有以下特点:

①总是在新行上开始,占据一整行;
②高度,行高以及外边距和内边距都可控制;
③宽带始终是与浏览器宽度一样,与内容无关;
④它可以容纳内联元素和其他块元素。

行内元素的特点:

①和其他元素都在一行上;
②高,行高及外边距和内边距部分可改变;
③宽度只与内容有关;
④行内元素只能容纳文本或者其他行内元素。
不可以设置宽高,其宽度随着内容增加,高度随字体大小而改变,内联元素可以设置外边界,但是外边界不对上下起作用,只能对左右起作用,也可以设置内边界,但是内边界在ie6中不对上下起作用,只能对左右起作用


转自 :https://www.cnblogs.com/peng-yan/p/5428324.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325385705&siteId=291194637