Centered Align content in Box using CSS Flex box. For both side vertical and Horizontal Middle align of Content in Specific sized Box.
Asked
Active
Viewed 127 times
-1
-
1Questions seeking help ("**why isn't, or how to make, this code working?**") must include the desired behavior, a _specific problem or error and the **shortest code necessary**_ to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Asons Jun 24 '17 at 07:35
-
1And the above apply on a [self-answered questions](https://meta.stackexchange.com/questions/235177/what-are-limitations-on-self-answered-questions) as well. – Asons Jun 24 '17 at 09:37
1 Answers
-1
.container{width:500px;height:200px;background-color:#333;display: flex;
justify-content: center;
align-items: center;}
h1{color:#fff;}
<div class="container">
<h1>
Hello Wolrd
</h1>
</div>

Dhruvang Gajjar
- 568
- 1
- 8
- 20