The Ultimate Mix Of Beauty and Usability

or

Centered content with vertical scrolling on small screens

Click here to see a demonstration, resize your window or use your smartphone landscape/portrait to see the UI suggested

The content we create is consumed on small and big screens, on the case of this article when we have a big screens we want the content be centered on the screen, but often the same content on a small screen height needs scrolling

Imagine a smartphone on portrait and landscape, on portrait it has a bigger height, on landscape it has a smaller height

Lets get started with a simple demonstration html markup for our example

The parent is going to occupy all the height available on the screen

We overflow because on this case we want to allow the parent to scroll and find the inner-parent content.

The inner-parent element is going to use the property margin: auto which is the magic that helps keep the content centered when on big screens

Conclusions

When the parent element uses display flex, the inner-parent element with margin auto is going to center itself vertically and horizontally

We've seen this technique being used on fixed menus on the left or right of the screen, and also on login/signup UIs. other modal forms, but it can be applyed to many purposes just like you want