Align a DIV to the center of his container

First, we have point something: we cannot center a div that its not sized. That's mean we have to specify a width and a height value. Here we have to consider this two cases:

1. Static positioned divs
To to center the div, set this CSS properties on:

 width:100px ; height:100px; margin-right: auto;  margin-left: auto; 
Child div:
width: 100px ; height 100px
Here the key are: the value auto in the margins and the size of the div.

Let's put the same div in the center-middle:
 width:100px ; height:100px; 
      margin-right: auto;  margin-left: auto; 
      margin-top: auto;  margin-bottom: auto; 
Child div:
width: 100px ; height 100px
Here is one limitation: You cannot align vertically a static block element because its always aligned to the top of his parent block or below its previous sibling.

2. Absolute positioned divs
 position:absolute; width:100px; height: 100px; right: 0;
      left: 0; margin-right: auto;  margin-left: auto; 
Child div:
width: 100px ; height 100px

Let's try to align it vertically:
 width:100px ; height:100px; 
      margin-right: auto;  margin-left: auto; 
      margin-top: auto;  margin-bottom: auto; 
      right: 0;  left: 0;
      top: 0;  bottom: 0;
Child div:
width: 100px ; height 100px