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.

This method places a centered text on top of a bitmap object. You can modify the method to add parameters like a custom color, alignment or others.

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...