HTML CSS examples for CSS Layout:Flex Center
Centering a div using flex and position: absolute
<html lang="en"> <head> <style> .flex-container {<!--from w w w .j a v a 2 s . co m--> display:-webkit-box; display:-ms-flexbox; display:-webkit-flex; display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; height:301px; background:Chartreuse; } .flex-overlapping-item { position:absolute; margin:auto; } </style> </head> <body translate="no"> <div class="container"> <div class="flex-container"> <div class="flex-overlapping-item"> <h3>Drag photo here</h3> <p>Photo must have 1000px x 1000px</p> </div> <div class="flex-overlapping-item drag-zone"> <div class="drag-zone-content"> </div> </div> </div> </div> </body> </html>