So you have a small content that when zoomed out in a WebView, you want it to be placed at the center of the screen vertically all the time. No CSS or Javascript code can make this work as I learned the hard way.

The solution that worked for me was to set the height of the WebView widget to wrap_content. Then aligning it in the middle vertically.

By far this is the best solution that I have come across with with regards to placing a Div element at the center both horizontally and vertically.

Add your custom width and height values to complete the result.

If you do not assign a width and height value, the Div will stretch its width to fill the screen but its height will be centered vertically depending on the content.

The guys in the chatroom of #famous specifically sunrising and talves helped me out in setting the vertical alignment of a text inside a Surface.

The key here is the lineHeight property. Take this Javascript code for example:

Take note there is no attribute to setting the vertical alignment in Famo.us. This is the only way to do it.

Related Posts Plugin for WordPress, Blogger...