Do you ever need to center the text of div tag align center in vertically and horizontally both?
Ofen you may need to center the text vertically in the web page. I found this requirement when I was designing the landing page of one my client’s website landing page. Often you also need to center the text-align vertically in the HTML page.
You may find the many code snippets around the web. So many are the very trick and some works on particular dimensions of the div tag.
So here I am sharing the code which lets your Text in div tag correctly align a center of the page.
The second advantage of this code snippet is that you can also use this snippet in the designing of the landing page of the website which has the centered text without scrolling the page.
Code Snippet of Vertically Center the text of div Tag in HTML CSS
The Another Way to Vertically Align Center the Text in The Div Tag
By this way you will get the following type of the output:
Hence this is not the only ways to centering the div tag in the text in the HTML div. You can find much more ways to do that. I will also update the post on the letter on to horizontally plus vertically center the text in HTML CSS web page.
If you know another simple way, please let share with us. You can also comment your views in the comment box.
You can also subscribe to the Code Puran newsletters to get the more tips like this.