CSS + HTML solution to center content in the windowThis example demonstrates how to center the content in the browser window. The solution is HTML+CSS only. No JavaScript needed. It does not require that you to know the content size in advance. The content stands centered on window resizing. The idea is to wrap the content in a TD element, as the "vertical-align" CSS property is only supported for table cells. "div_wrap" is added to restore "text-align" to "left" and to protect you from wondering why added block level elements look only vertically centered(they fit all the width by default and their content is left aligned). --- © Delian Krustev - http://krustev.net You can do whatever you like with this code. The only condition is that any derived work must have a reference to the original author. |