Center mainly can be divided into text center and picture Center:
1 ways you can use text and pictures:
Text Use this method is best to first convert the row class block element
(1) Relative positioning: First output text and pictures in the page and then see where you want to move it
{position:relative;
Top:? ; Botton:? ; Left:? ; Right:? ;}
(2) Absolute positioning: Set the relative positioning position:relative for the parent, the child set Position:absolute;
The child moves relative to its own parent;
(3) margin and padding set up and down around, top,botton,left,right
(4) Margin:auto directly in the plate horizontal center
2 for text:
Text-align:center: Horizontally centered within the width of this element setting
Line-height: The distance between rows and lines, which can directly center the text in the row
Special centering: A child's frame is centered in its parent frame and its two centers are coincident
The first child is in the upper-left corner of the parent
Methods: 1 The child absolutely locates the parent, moves the parent down by 50%, moves the parent width to the left by 50%, and then moves itself to the right by the width of 50%, up to the height of 50%
Personal summary of "centering" in CSS