2021年1月4日星期一

How to calculate and adjust vertical align offset

I am trying to vertically align content.

The two methods I use most are:

selector{      display: grid;      place-items: center;  }  

and

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

However, it seems that when it does this, it is vertically aligning the top of the content, meaning it is slightly shifted downwards. Is there an easy way to calculate and account for this offset?

https://stackoverflow.com/questions/65572266/how-to-calculate-and-adjust-vertical-align-offset January 05, 2021 at 10:05AM

没有评论:

发表评论