Method horizontal vertical center

1. absolute positioning , 50% each from the upper left (this time will be biased, since the element itself has a certain width and height), disposed translate each -50% (in the horizontal direction, the vertical direction)

 position: absolute;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%)

  

Guess you like

Origin www.cnblogs.com/yaya-003/p/12072212.html