Horizontal and vertical centering above a sticky footer in CSS

后端 未结 2 1042
遥遥无期
遥遥无期 2021-02-15 12:54

Given a sticky footer such as that on Ryan Fait\'s site with a fixed pixel height, is it possible to center, both horizontally and vertically, variable-size content in the space

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-15 13:00

    well, then you could set this for the vertical align of content:

    .verticalalign{
    width:270px;
    height:150px;
    position:absolute;
    left:50%;
    top:50%;
    margin:-75px 0 0 -135px;
    

    }

提交回复
热议问题