Added a convenience function for centering an element