window.onload = function(){
            var xx = document.documentElement.clientHeight;
            // 470为要垂直居中的div的高度
            he = (xx-470)/2;
            console.log(he);
            document.getElementsByClassName('weixin_public')[0].style.marginTop = he + 'px';
        
        }

 

通过以上的js控制即可达到垂直居中的效果

相关文章:

  • 2021-05-17
  • 2022-01-05
  • 2021-04-03
  • 2021-07-08
  • 2021-05-18
  • 2022-02-17
  • 2022-02-22
  • 2022-12-23
猜你喜欢
  • 2021-11-13
  • 2021-12-13
  • 2022-01-09
相关资源
相似解决方案