登录 | 注册 | FAQ
Anonymous

Vertical centering

+ 发表回复

2 篇帖子 分页: 1 / 1


Vertical centering

lombardyjim » 周四 10月 05, 2017 4:11 pm

I have a title in a header. I can horizontally center, but can't get it off the top line in the header. Ideas? I need code, please, as an example. Thanks!
头像

lombardyjim

  • 帖子: 8
  • 注册: 周二 6月 06, 2017 2:54 pm

Re: Vertical centering

pavithra.ramesh » 周二 2月 13, 2018 11:19 am

You can use many methods.
Here are a few examples:

Marging Top

h1{margin-top:50px;}


If you want to position the title vertically in the center, you can choose the following code.
.header {
position: relative;
}
.h1 {
position: absolute;
top: 50%;
transform: translateY(-50%);
}

Check this code. I hope this should work. Please let me know if it doesn't work. I will create a pen in the codepen and share you the link.


Regards,

Pavithra Ramesh
Spidergems
头像

pavithra.ramesh

  • 帖子: 9
  • 注册: 周二 2月 06, 2018 10:50 am


+ 发表回复

分页: 1 / 1