Center Text in just Two Lines of CSS

I am 17 years old and a young passionate and self-taught frontend web developer and have an intention to become a successful developer. I usually write about JavaScript and Web Development and share some tips in the articles.
Using Flexbox
/* Method 1 - Centering DIV using Flexbox */
.div1 h1{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
Using Grid
/* Method 2 - Center DIV using Grid */
.div2 h1{
display: grid;
place-content: center;
}
So simple 😀
And make sure to center(align-mind: center)😜 your focus towards my YouTube Channel




