将html表单与中心对齐

将html表单与中心对齐,html,css,alignment,center,css-tables,Html,Css,Alignment,Center,Css Tables,下面的html代码在表格中提供了一个html表单,但尽管我将表格对齐到中心,但它没有对齐到中心,而是保留在网页的左侧 <!DOCTYPE html> <html> <head> <style>input.textfill { float: right; }</style> <link type="text/css" rel="stylesheet" href="order.css" >

下面的html代码在表格中提供了一个html表单,但尽管我将表格对齐到中心,但它没有对齐到中心,而是保留在网页的左侧

 <!DOCTYPE html>
<html>
<head>
    <style>input.textfill {
        float: right;
    }</style>
    <link type="text/css" rel="stylesheet" href="order.css" >
            <script type="text/javascript">


           var textbox = function(me){
  if(me.checked == false){
    var textb = document.createElement('textarea');

    textb.name = "Address";

      textb.id="Address";

      textb.required=true;




      textb.placeholder="Address";
    me.parentNode.appendChild(textb);


  }
  setInterval(function(){
    if(me.checked == false){
       me.parentNode.removeChild(textb);
       return false;
    }
  });
}; 

            var i = 1;

function addkid() {
    if (i <= 2) {
        i++;
        var div = document.createElement('div');
        div.innerHTML ='<br><div class="headingbox">'+ 'Prescription Copy-'+i+':'+'</div>'+'<br><input id="uploadFile-' + i + '" class="disableInputField" placeholder="Choose File" disabled="disabled" />'+'<label class="fileUpload">'+'<input id="uploadBtn-' + i + '" type="file" required class="upload" name="Image'+i+'" />'+'<span class="uploadBtn-' + i + '">Upload</span>'+'</label>'+'  <input id=remove type="button" value="-" onclick="removekid(this)">';
        document.getElementById('kids').appendChild(div);

        document.getElementById("uploadBtn-" + i).onchange = function()  {
            document.getElementById("uploadFile-"+i).value = this.value;
        };
    }
}



function removekid(div) {
  document.getElementById('kids').removeChild(div.parentNode);
  i--;
}



            </script>
    </head>

     <body bgcolor="#E6E6FA">
        <form id=orders name="orders" action="orders_action.php" method="post" enctype="multipart/form-data"  onsubmit="return Validate(this);onTimeChange ();">

            <table align="Center"  >

               <tr><td height="40"><br>
            <div class="headingbox" id="hBoxNIC" > National ID  </div>
            <div style="width:100%;text-align:center;">
            <input type="text" placeholder="920290505v" maxlength="13" name=NIC required   autofocus  />
                   </div>

            </td></tr>
            <tr><td height=50 ><div class="headingboxs">Pick up</div>
                <input   type=radio name=DP  required value="Pickup">

<div style="  float: right;"><div class="headingboxs">
    Delivery</div>
                    <input  class="textfill" type=radio name=DP required value="Delivery" onmouseup="textbox(this)" /></div><br><br></td></tr>


<tr><td height="50"><div class="headingbox" >Expected Time </div>
            <div style="width:100%;text-align:center;">
            <input type="time" id=time  autofocus name=DPTime    onfocusout="hid('timeerror2');" onfocus="show('timeerror2');"min="09:00:00" max="22:00:00" /><br>
            </div>

               <div class="poperror" id="timeerror2"> Pharmacy is opened from 9AM to 10PM  </div>
    <script>
var input =  document.getElementById('time');
function validateTime (element) {

var minTime = element.min;
var maxTime = element.max
var value = element.value + ':00'

if(minTime > value || value > maxTime) {
console.log("Time is outside of min/max.");
}

}       

</script>  

                </td></tr>


<tr><td height="50"><div class="headingbox" id="hBoxPN"> Phone Number </div>
            <div style="width:100%;text-align:center;">

            <input type="text" maxlength=10;  autofocus name=Tele /><br>
            </div>
            <div class="error" id="phoneerror" > error occured </div><br></td></tr>





            <tr><td height="50"><div class="headingbox" id="hBoxEM"> E-mail </div>
            <div style="width:100%;text-align:center;">
            <input type="text"  autofocus name=Email placeholder="xxx@gmail.com"    /><br>
            </div>
            <div class="error" id="emailerror" > error occured </div><br>

                </td></tr>
                         <tr>
                    <td height="50" width=330><br><div class="headingbox"> Prescription Copy-1</div> <div id="kids">

<input id="uploadFile" class="disableInputField" placeholder="Choose File" disabled="disabled" />


<label class="fileUpload">
    <input id="uploadBtn" type="file" class="upload" name=Image1 />
    <span class="uploadBtn">Upload</span>
</label>



        <input type="button" id="add" onclick="addkid()" value="+" />

      </div></td></tr>
                <script>
                document.getElementById("uploadBtn" ).onchange = function()  {
            document.getElementById("uploadFile").value = this.value;
        };
    </script>


        </div></td></tr>

            <tr><td colspan=5 align=center>
                <input class="button" type=submit name=submit value=Place >
                <input class="button" type=reset name=reset value=Cancel> </td></tr>
            </table>

              </form>
</body>
请帮助纠正此问题,以便我可以将表单与中心对齐

form {
    width: 980px;
    margin: 0 auto;
}
声明宽度。因此,您可以在边距中使用“自动”值。边距:0自动执行此操作

* { margin:0; padding:0;font-family: Arial; }

#orders {
    padding: 0px 25px 25px;
    background: #dcdcfb;
    box-shadow: 
        0px 0px 0px 5px rgba( 255,255,255,0.4 ), 
        0px 4px 20px rgba( 0,0,0,0.33 );
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    display: table;
    position:center;
    width:60%;
    margin: 20px;
}


#orders .inputs .buttonS {
    width: 100%;
    outline:none;
    margin-top: 20px;
    padding: 15px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
        background: -moz-linear-gradient(
        top,
        #b9c5dd 0%,
        #a4b0cb);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#b9c5dd),
        to(#a4b0cb));
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    border: 1px solid #737b8d;
    -moz-box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    -webkit-box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    text-shadow:
        0px 1px 3px rgba(000,000,000,0.3),
        0px 0px 0px rgba(255,255,255,0);
    display: table;
    position: static;
    clear: both;
}

#orders .inputs .buttonS:hover {
    background: -moz-linear-gradient(
        top,
        #a4b0cb 0%,
        #b9c5dd);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#a4b0cb),
        to(#b9c5dd));
}

#orders .inputs .buttonDis {
    outline:none;
    width: 100%;
    margin-top: 20px;
    padding: 15px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
        background: -moz-linear-gradient(
        top,
        #e0e0e0 0%,
        #bfbfbf);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#e0e0e0),
        to(#bfbfbf));
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    border: 1px solid #737b8d;
    -moz-box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    -webkit-box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    text-shadow:
        0px 1px 3px rgba(000,000,000,0.3),
        0px 0px 0px rgba(255,255,255,0);
    display: table;
    position: static;
    clear: both;
}

#Address{

    background: #f5f5f5;
    font-size: 0.8rem;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    border: none;
    padding: 13px 10px;
    width: 90%; 
    margin: auto;
    margin-bottom: 17px;
    box-shadow: inset 0px 2px 3px rgba( 0,0,0,0.1 );
    -ms-box-sizing:content-box;
    -moz-box-sizing:content-box;
    box-sizing:content-box;
    -webkit-box-sizing:content-box; 
    transition: all .5s ease-in-out;

}

.inputs select, input[type=date], input[type=text], input[type=password],input[type=time] {
    background: #f5f5f5;
    font-size: 0.8rem;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    border: none;
    padding: 13px 10px;
    width: 90%; 
    margin: auto;
    margin-bottom: 17px;
    box-shadow: inset 0px 2px 3px rgba( 0,0,0,0.1 );
    -ms-box-sizing:content-box;
    -moz-box-sizing:content-box;
    box-sizing:content-box;
    -webkit-box-sizing:content-box; 
    transition: all .5s ease-in-out;
}

.inputs select:focus, input[type=date], input[type=text]:focus{
    background: #fff;
    box-shadow: 0px 0px 0px 3px #8efffc, inset 0px 2px 3px rgba( 0,0,0,0.2 ), 0px 5px 5px rgba( 0,0,0,0.15 );
    outline: none;   
}





.inputs ul li label{
  display: block;
  position: relative;
  font-weight: 300;
  font-size: 18px;
  padding: 25px 25px 25px 80px;
  margin: 10px auto;
  height: 30px;
  z-index: 9;
  cursor: pointer;
  -webkit-transition: all 0.25s linear;
}

.inputs ul li:hover label{
    color: #FFFFFF;
}

.inputs ul li .check{
  display: block;
  position: absolute;
  border: 5px solid #AAAAAA;
  border-radius: 100%;
  height: 25px;
  width: 25px;
  top: 30px;
  left: 20px;
  z-index: 5;
  transition: border .25s linear;
  -webkit-transition: border .25s linear;
}



.inputs input[type=radio]:checked ~ label{
  color: #0DFF92;
}
.headingboxs{ /*for the radio button headings */
    position:relative;
    text-align:left;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 2px;
    padding-top: 5px;
    border-top-left-radius:2em;
    border-top-right-radius:-2em;
    border-bottom-right-radius:2em;
    border-bottom-left-radius:-2em;
    border-bottom-left-radius:-2em;
    background: white;
    left: 2%;
    font-weight: bold;
    display: inline-block;
    box-shadow: inset 0px 2px 3px rgba( 0,0,0,0.1 );
    transition: all .5s ease-in-out;
}


.headingbox{ /*for other  headings */
    position:relative;
    text-align:left;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 2px;
    padding-top: 5px;
    border-top-left-radius:2em;
    border-top-right-radius:0;
    border-bottom-right-radius:2em;
    border-bottom-left-radius:-2em;
    border-bottom-left-radius:-2em;
    background: white;
    left: 4%;
    font-weight: bold;
    display: inline-block;
    box-shadow: inset 0px 2px 3px rgba( 0,0,0,0.1 );
    transition: all .5s ease-in-out;
}

.headbox{ /*for other  headings */
    position:relative;
    text-align:left;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 2px;
    padding-top: 5px;


    background: white;
    left: 4%;
    font-weight: bold;
    display: inline-block;
    box-shadow: inset 0px 2px 3px rgba( 0,0,0,0.1 );
    transition: all .5s ease-in-out;
}

.poperror {
    opacity:0;
    visibility: visible;
    width: 300px;
    background-color: white;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 5;
    !top: 100%;
    !left: 100%;
    margin-left: 10px;
    margin-top: -15px;
    -moz-box-shadow: 0 0 10px black;
    -webkit-box-shadow: 0 0 10px black;
    box-shadow: 0 0 10px black;
    -webkit-transition: opacity 0.4s;
    -moz-transition: opacity 0.4s;
    -o-transition: opacity 0.4s;
    transition: opacity 0.4s;
}



.poperror::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 5%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent white transparent;
}

.error{
    color:red;
    font-size:10px;
    text-align:left;
    width: 350px;
    margin-left:auto;
    margin-right:auto;
    margin-top:-12px;
    margin-bottom:-10px;
    font-style: italic;
    -webkit-transition: opacity 0.4s;
    -moz-transition: opacity 0.4s;
    -o-transition: opacity 0.4s;
    transition: opacity 0.4s;
    opacity:0;
}

.column{
    width:50%;
    float:left;
}
*{
    box-sizing:border-box;
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
}

#remove{
    width: 30px;
    font-size: 20px;
    background-color: gray;
    color: white;

}

#add{
    width: 30px;
    font-size: 20px;
    background-color: gray;
    color: white;

}
.inputBtnSection{
    display:inline-block;
    vertical-align:top;
    font-size:0;
    font-family:verdana;
}
.disableInputField{
    display:inline-block;
    vertical-align:top;
    height: 27px;
    margin: 0;
    font-size:14px;
    padding:0 3px;
}

.fileUpload {
    position: relative;
    overflow: hidden;

    display:inline-block;
    vertical-align:top;
}
.fileUpload-2 {
    position: relative;
    overflow: hidden;

    display:inline-block;
    vertical-align:top;
}
.fileUpload-3 {
    position: relative;
    overflow: hidden;

    display:inline-block;
    vertical-align:top;
}
.uploadBtn{
    display:inline-block;
    vertical-align:top;
    background:rgba(0,0,0,0.5);
    font-size:14px;
    padding:0 10px;
    height:25px;
    line-height:22px;
    color:#fff;
    border-radius: 5px;
}
.uploadBtn-2{
    display:inline-block;
    vertical-align:top;
    background:rgba(0,0,0,0.5);
    font-size:14px;
    padding:0 10px;
    height:25px;
    line-height:22px;
    color:#fff;
    border-radius: 5px;
}
.uploadBtn-3{
    display:inline-block;
    vertical-align:top;
    background:rgba(0,0,0,0.5);
    font-size:14px;
    padding:0 10px;
    height:25px;
    line-height:22px;
    color:#fff;
    border-radius: 5px;
}
.fileUpload input.upload {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    padding: 0;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    filter: alpha(opacity=0);
}
table {
    align-self: center;
    border: 2px solid CadetBlue;
    border-radius: 5px;
}


#add_kid(){
    width: 50px;
    font-size: 10px;
}
.button:hover {
    cursor:pointer;
    background: -moz-linear-gradient(
        top,
        #a4b0cb 0%,
        #b9c5dd);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#a4b0cb),
        to(#b9c5dd));
}


.button{
    margin-left:30px;
    outline:none;
    width: 20%;
    margin-top: 20px;
    padding: 15px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
        background: -moz-linear-gradient(
        top,
        #e0e0e0 0%,
        #bfbfbf);
    width: 150px;
    background-color:grey;
    border-radius: 5px;
    height: 40px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    border: 1px solid #737b8d;
     -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
     background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#e0e0e0),
        to(#bfbfbf));

    -moz-box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    -webkit-box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    box-shadow:
        0px 5px 5px rgba(000,000,000,0.1),
        inset 0px 1px 0px rgba(255,255,255,0.5);
    text-shadow:
        0px 1px 3px rgba(000,000,000,0.3),
        0px 0px 0px rgba(255,255,255,0);
}

#white-background{
                display: none;
                width: 100%;
                height: 100%;
                position: fixed;
                top: 0px;
                left: 0px;
                background-color: #fefefe;
                opacity: 0.7;
                z-index: 9999;
            }

            #dlgbox{
                /*initially dialog box is hidden*/
                display: none;
                position: fixed;
                width: 480px;
                z-index: 9999;
                border-radius: 10px;
                background-color: #7c7d7e;

            }

            #dlg-header{
                background-color:aliceblue;
                color: white;
                font-size: 20px;
                padding: 10px;
                margin: 10px 10px 0px 10px;
            }

            #dlg-body{
                background-color: white;
                color: black;
                font-size: 14px;
                padding: 10px;
                margin: 0px 10px 0px 10px;
            }

            #dlg-footer{
                background-color: #f2f2f2;
                text-align: right;
                padding: 10px;
                margin: 0px 10px 10px 10px;
            }

            #dlg-footer button{
                background-color: grey;
                color: white;
                padding: 5px;
                border: 0px;
            }
form {
    width: 980px;
    margin: 0 auto;
}