html - centering div not working -


i trying center text , form field inputs in #registration-code-entry .registration-code-entry-content div

not sure doing wrong.

http://jsfiddle.net/ylx4f/

enter image description here

<div id="registration-code-entry">     <div class="registration-code-entry-header"></div>      <div class="registration-code-entry-middle">         <div class="registration-code-entry-content">             <form class="registration-form">                  <div class="field">                     <input type="text" name="first_name" placeholder="*first name" class="required" />                 </div>                 <div class="field">                     <input type="text" name="last_name" placeholder="*last name" class="required" />                 </div>                 <div class="field">                     <input type="email" name="email" placeholder="*email address" class="required" />                 </div>                 <div class="field">                     <input type="text" name="phone" placeholder="phone number" />                 </div>                  <div class="field">                     <input type="checkbox" name="optin">                     <label for="optin" />yes, receive more information</label>                 </div>                  <div class="field">                     <input type="checkbox" name="accept" class="required" />                     <label for="accept">*i accept <a href="#" class="view-official-rules">official rules</a>.</label>                 </div>                  <input type="submit" class="submit-btn" value="">             </form>          </div>     </div>      <div class="registration-code-entry-footer"></div> </div>  

css

#registration-code-entry {     height: 100px;     width: 359px;     position: absolute;     top: 100px;     right: 20px;     background: transparent;      .registration-code-entry-header {         top: 0;         background: transparent url('../images/form-header.png') no-repeat;         width: 359px;         height: 17px;     }      .registration-code-entry-middle {         background: #713487;          .registration-code-entry-content {             border: 1px solid red;             width: 350px;             margin: 0 auto;             color: #fff;              form {                  display: inline-block;                 margin: 0 auto;                  .field {                     margin: 10px 0;                      input[type="email"], input[type="text"] {                         padding: 5px;                     }                 }                  input.submit-btn {                     background: transparent url('../images/submit-btn.png') no-repeat;                     width: 168px;                     height: 59px;                     display: block;                     border: 0;                 }             }         }     }      .registration-code-entry-footer {         display: block;         bottom: 0;         background: transparent url('../images/form-footer.png') no-repeat;         width: 359px;         height: 11px;     } } 

you can add text-align: centerto .field. can change display: block form make form expand full width of parent.

jsfiddle


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -