Foreword
After reading many posts, I found that there is no centered layout that can be directly used by novices. So here is a summary, which can be regarded as my little accumulation of centered layout, and it is also convenient for beginners to use immediately.
1. Element classification
1. Inline elements
Inline elements, that is, inline elements, can display multiple elements in one line. Note: The height, width, and top and bottom margins of an element cannot be set. The height and width of an element are the height and width of the text or image it contains.
Inline elements include these:
Of course, sometimes it can be turned into a block-level element through the following code:
display: block;
2. Block-level elements
Block-level elements occupy one row, and other elements must be placed in separate rows. Note: The height, width, and top and bottom margins of the element can be set. If the width of the element is not set, it is 100% of its parent container.
Block-level elements include these:
,
,