New implementation using margin instead of translate()

We keep translate for centering, but use margin for a better transition.
Close #2