Vertically and horizontally center any HTML element

Hello

I am working on an application, the UI is very dynamic for the application.
I want to know what is the best way to center an html element inside another. For ex I want my main content div to be certically and horizontally center. Inside that center cotainer I have center text.

Flexbox might be a good solution:
Add this to CSS styling:

display: flex;
justify-content: center; /* align horizontal /
align-items: center; /
align vertical */

This has to be added to container or the content.
And I want my content to be in center of page, both vertically and horizontally

.container
{display: flex;
justify-content: center; /* align horizontal /
align-items: center; /
align vertical */
}

http://the-echoplex.net/flexyboxes/

Does this help?

@naveenkarippai1

Yeah, thanks I will check it out

no it doesn’t work
maybe something is wrong