方法1:

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

方法2:

display: flex;
align-items: center;
justify-content: center;

方法3:

.parent-panel2:after{
    content:"";
    display: inline-block;
    vertical-align: middle;
    height: 100%;
 }

定宽度

position:absolute;
top:50%;
left:50%;
margin-top:(width/2);
margin-left:(width/2);

 

相关文章:

  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-11-21
  • 2021-08-10
  • 2021-08-20
猜你喜欢
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-05-28
  • 2021-06-22
相关资源
相似解决方案