Horizontal aligning can be done simply. Element has to have a fixed width and no floating applied. Width auto or 100% doesn't work.
margin:0 auto; width:400px;
Some times you may need more complex horisontal aligning. Like positioning a splash in the middle of the screen. Then you pair horisontal aligning with vertical aligning. Without the margin-left and the fixed width here, the element would be positioned by it's left-top corner.
height:auto; left:50%; margin-left:-200px; position:absolute; top:30%; width:400px;