The difference between inline, block and inline-block is: CSS

 

block

Block-level elements features:

1, each of the block-level element start a new line, and the subsequent elements are also on a separate line. (Pretty strong, a block element on a separate line)

2, height, width, line height, and a top margin and a bottom element can be set.

3, in the case where the width of the elements is not provided, is the (same width and the parent element) 100% of the parent container itself, unless a set width.

 

 

inline

Features inline elements:

1, and other elements on one line;

2, the height, width, and top and bottom margins of elements is not provided;

3, the width of the elements is that it contains text or image width can not be changed.

 

 

inline-block

Inline block elements (inline-block) is also have the characteristics of inline elements, block elements.

inline-block elements Features:

1, and other elements on one line;

2, height, width, line height, and a top margin and a bottom element can be set.

 

 

 

--- end --- restore content

--- --- restore content begins

block

Block-level elements features:

1, each of the block-level element start a new line, and the subsequent elements are also on a separate line. (Pretty strong, a block element on a separate line)

2, height, width, line height, and a top margin and a bottom element can be set.

3, in the case where the width of the elements is not provided, is the (same width and the parent element) 100% of the parent container itself, unless a set width.

 

 

inline

Features inline elements:

1, and other elements on one line;

2, the height, width, and top and bottom margins of elements is not provided;

3, the width of the elements is that it contains text or image width can not be changed.

 

 

inline-block

Inline block elements (inline-block) is also have the characteristics of inline elements, block elements.

inline-block elements Features:

1, and other elements on one line;

2, height, width, line height, and a top margin and a bottom element can be set.

 

Guess you like

Origin www.cnblogs.com/adongyo/p/11290826.html