-1

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?

Community
  • 1
  • 1
Rohan
  • 1,597
  • 3
  • 15
  • 24

1 Answers1

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

<div id="big">
  <div id="small"></div>
</div>
cambraca
  • 27,014
  • 16
  • 68
  • 99