Block Elements & Inline Elements

Most HTML elements are defined as block-level elements or inline elements. Block-level elements usually start (and end) on a new line when displayed by the browser

block element features
1 always starts on a new line;
2 Height, line height, and outer and inner margins can be controlled;
3 The width defaults to 100% of its container unless a width is specified.
4 It can hold inline elements and other block elements
 
inline element features
1 and other elements are all on one line;
2 Height, line height and outer and inner margins cannot be changed; (margin padding is only valid for left and right margins, and top and bottom are invalid)
3 The width is the width of its text or picture, which cannot be changed
4 Inline elements can only hold text or other inline elements

Guess you like

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