HTML Element Style How to - Center div inside another div


We would like to know how to center div inside another div.


<!DOCTYPE html>
<style type='text/css'>
#bg {<!--  w w w. java 2 s . c om-->
  background-color: red;

#content {
  margin-left: auto;
  margin-right: auto;
  position: relative;
  left: 0px;
  top: 0px;
  width: 200px;
  background-color: #EEE;
  <div id="bg">
    <div id="content">Here is my content.</div>

The code above is rendered as follows: