Margin-top refers to the width of the parent element.

  • You can use margin-top for children to support the height of the parent element.
  • If you set max-height on the parent element, the child will run out if it goes beyond a maximum.
  • Margin-top is 10px apart from the height of the ‘father’ text, not the top edge of the parrentdiv
  <div id="parent"> parent <div id="children"</div> </div>Copy the code

Adapt to the layout of the use of knowledge

Horizontal center
Old: text-align + inline-block New: flex juety-contentCopy the code
Vertical center
Old: table-cell + vertical-align New: flex align-itemCopy the code

Global layout

Mainly using absolute positioning, there is a special trick: Font-size: 14px "> < span style =" font-size: 14px; font-family: 'times New Roman'; Height: Calc (100vh - height to be subtracted) - coloum = coloum; This is height adaptive - using the difference between left and right to determine the width of the element - and position plus marginCopy the code