-1

I want to center a form with a background to the center of the page, how can I go about doing that? I can't seem to find a way to properly place it in the middle of the screen with the form elements.

<div id="content" style="background-color: #e7e7e7;text-align: center; width:100%; height: 1000px; top: 360px; left:0px; padding-top: 100px; position: absolute; overflow: hidden;">
<form id="contact-form" action="contact.php" method="post" style="padding-top: 100px; list-style-type: none; text-align: center; width: 916px; height:660px;  background-image:url('../images/contact.png'); background-repeat: no-repeat;">
    <input type="hidden" name="redirect" value="/sent" />
    <ul>
        <li>
            <input type="text" name="name" class="name" value="" /> 
        </li>

        <li>
         <input type="text" name="company" class="company" value="" />
        </li>
    </ul>
</form>
</div>
Julian Camilleri
  • 2,582
  • 1
  • 22
  • 33

2 Answers2

0

Give the margin auto for your left and right sides.

  #content{
    margin:0px auto
  }
Ankur Aggarwal
  • 2,913
  • 5
  • 29
  • 53
0
<form id="contact-form" action="contact.php" method="post" 
style="padding-top: 100px; list-style-type: none; text-align: center; 
width: 916px; height:660px;  background-image:url('../images/contact.png'); 
background-repeat: no-repeat;"></form>

add

margin-left:auto; margin right:auto 

along with the inline style inside form

Blu
  • 3,926
  • 6
  • 35
  • 64
Jijo Lopez
  • 36
  • 4