to center a div, it first need a set size, and then margin left and right set to auto, like:
Code:
width: 200px;
margin-left: auto;
margin-right: auto;
The auto parameter makes sure the margin has the same value on the left and right side of the div, as you probably noticed setting margin-left: 48%; only shifts the div to have it's left side somewhere near the middle of the page. In theory it would work if you did something like:
Code:
width: 4%;
margin-left: 48%;
margin-right: 48%;
This example would theoretically work (I say theoretically due to the fact that if you mix in a border it would possibly fail on some browsers) since you tell the browser how to use the full width of the page, and would give you a dynamic width on the div, with a fixed with, you need to use the auto parameter for left and right margins.