HTML Element Style How to - Center inner div in another div


We would like to know how to center inner div in another div.


<!--from   w  w  w .j  a v  a  2 s .co  m-->
<!DOCTYPE html>
<style type='text/css'>
#header {
  background: blue;

#main {
  width: 200px;
  height: 50px;
  margin: 0 auto;
  background: red;
  <div id="header">
    <div id="main"></div>

The code above is rendered as follows: