Can never understand how to dead center

Can never understand how to dead center
0.0 0

#1

Hi there,

I just cant get my head around what i’m doing wrong here,

I’m trying to dead center the text “Italian food” in the middle of the page,right now its horizontally centered but NOT vertically, where is my logic going wrong?

Thanks in advance


#2

#main is only taking up the height that it needs, which is the same height as #main-text. Just set a height for #main and #main-text will vertically center inside it.

Note that you can use calc() to center it perfectly: height: calc(100vw - 60px). Where the 60px is the height of the navbar.


#3

Looks ok to me. :eye::eye:


#4

thanks dude…seemed to work (height: calc(100vw - 60px))