HTML CSS examples for CSS Layout:Flex Center
Using Firefox to layout flex-item to page center
<html lang="en"> <head> <title>answer for https://stackoverflow.com/q/44389126</title> <style> .container {<!--from ww w . ja v a 2 s .com--> position: fixed; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; top: 0; left: 0; right: 0; bottom: 0; overflow: auto; background: #f88; } .content-wrapper { margin: auto; } .content { width: 500px; margin: 20px; border: 1px solid currentColor; background: #8f8; } </style> </head> <body translate="no"> <div class="container"> <div class="content-wrapper"> <div class="content"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, facilis omnis inventore, illum eos quis fuga quos id, labore consectetur quas. Unde sed nemo nobis recusandae saepe ex nulla accusantium?</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias asperiores a enim magnam voluptatem. Ab sint possimus quis odit vero explicabo unde quod rem, quasi voluptatibus cupiditate voluptatem veritatis repudiandae.</p> </div> </div> </div> </body> </html>