How do you center a div within a div, vertically and horizontally?

Possible Duplicate:
How to make an image center (vertically & horizontally) inside a bigger div

So I have a div which is 300px in both height and length. I want a div which is 100px in height and width to be within that div, centered horizontally and vertically. So basically there is 100px on every side of the inner div. How do i do that?


#big {
  width: 300px;
  height: 300px;
}
#small {
  width: 100px;
  height: 100px;
  margin: 100px;
}

<div id="big">
  <div id="small"></div>
</div>
链接地址: http://www.djcxy.com/p/75760.html

上一篇: 如何集中图像的绝对位置?

下一篇: 你如何在一个div内垂直和水平居中一个div?