What matters should be paid attention to when elements are centered in HTML
This article mainly explains "what matters should be paid attention to in the center of elements in HTML". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what matters should be paid attention to in the center of elements in HTML".
Do not use positioning
Horizontal Center: text-align=center; (inheritable)
Center vertically: margin:0auto; (block-level elements)
Other Center:
1. Text center: parent element sets high child element sets high line-height=height (parent element)
two。 Picture center: vertical-aign:middle