title: Centering the elements in div
body: <p>I am trying to center the label and input elements. </p>
  
  <p>I tried both, <code>text-align: center;</code> and <code>margin: 0 auto;</code> but it is not getting affected. below i have pasted both html as well as css code.</p>
  
  <p>green color are labels below under them are input and select elements</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="container"&gt;
          &lt;div id="header"&gt; &lt;/div&gt; &lt;!--header--&gt;
          &lt;div id="content"&gt; 
              &lt;div id="searchForm"&gt;
                  &lt;form method="" action="post"&gt;
                      &lt;div&gt;
                          &lt;label for="keywords"&gt; Keywords &lt;/label&gt;
                          &lt;input type="text" name="keywords"&gt;
                      &lt;/div&gt;
  
                      &lt;div&gt;
                          &lt;label for="location"&gt; Location &lt;/label&gt;
                          &lt;input type="text" name="location"&gt;
                      &lt;/div&gt;
  
                      &lt;div&gt;
                          &lt;label for="job_category"&gt; Job Category &lt;/label&gt;
                          &lt;input type="text" name="job_category"&gt;
                      &lt;/div&gt;
  
                      &lt;div&gt;
                          &lt;label for="experience"&gt; Experience &lt;/label&gt;
                          &lt;input type="text" name="job_category"&gt;
                      &lt;/div&gt;
  
                      &lt;div&gt;
                          &lt;label for="experience"&gt; Salary Expectation &lt;/label&gt;
                          &lt;select name="min_exp"&gt;  
                              &lt;option value=""&gt; Min &lt;/option&gt;
                          &lt;/select&gt;
  
                          &lt;select name="max_exp"&gt;  
                              &lt;option value=""&gt; Max &lt;/option&gt;
                          &lt;/select&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt; &lt;!--searchForm--&gt;
          &lt;/div&gt; &lt;!--content--&gt;
          &lt;div id="footer"&gt; &lt;/div&gt; &lt;!--footer--&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>CSS</strong></p>
  
  <pre><code>* {
  margin: 0;
  padding: 0;
    }
  
  
   #body {
  background-color: #FFFFFF;
  text-align: center;
  }
  
  
  #container {
  margin: 0 auto;
  width: 96%;
  }
  
  
  #header {
  width: 100%;
  height: 100px;
  border: 1px solid #CCCCCC;
  }
  
  
    #content {
  border: 1px solid #F7F7F7;
  
    }
  
  
  #searchForm {
     width: 100%;
     text-align: center;
     background-color: red;
     overflow:hidden;
     margin: 0 auto;
  }
  
  
  #searchForm div {
  background-color: green;
  float: left;
  text-align:center;
  margin-left:5px;
  }
  
   #searchForm label {
  display: block; 
   }
  
  
  
   #footer {
  width: 100%;
  height: 60px;
  border: 1px solid #CCCCCC;
   }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/KcaNJ.png" alt="enter image description here"></p>