I have created a form on php.i would like this form to appear in the center of the screen but i dont know css very well.this is the css code i have created:
body{ font:100% normal Arial, Helvetica, sans-serif; background:#161712;}
*{
margin:0;
padding:auto;
}
th {
color:#ffffff;
font-size:18px;
border-bottom:1px solid #161712;
border-top:1px solid #161712;
}
h2{
text-align:center;
color:#CC0000;}
table {
color:#bbb;
position:relative;
float:left;
margin-left: 150%;
padding:30px;
border-bottom:#505050 thin solid;
}
.tr_caption {
font-weight: bold;
}
form {
width:400px;
}
input {
padding:10px 10px;
width:200px;
background:#262626;
color:#fff;
border-bottom: 1px double #171717;
border-top: 1px double #171717;
border-left:1px double #333;
border-right:1px double #333;
}
.button {
position: relative;
margin-bottom:10px;
float:right;
background:#CC0000;
border:0px;
top:10px;
left:482px;
width:100px;
bottom:50px;
border-bottom: 1px double #660000;
border-top: 1px double #660000;
border-left:1px double #FF0033;
border-right:1px double #FF0033;
}
.button:hover {
background:#580000;
border:0px;
color:#FFF5CC;
}
Also, I’m attaching a photo of the view of my screen:

<body>
<h2>Φόρμα συμπλήρωσης στοιχείων</h2>
<?php
if (isset($_POST['submit']))
if (checkForm() == "")
{
makeXML();
sendXML();
}
else echo "<font color='blue'>".checkform()."</font><br/><br/>";
?>
<form method="post">
<table width="500px" >
<tr><th colspan="2" >Στοιχεία του Πελάτη</th></tr>
<tr><td>Όνοματεπώνυμο</td> <td><input type="text" name="custName" size="40" value="<?php echo $_POST["custName"];?>"> </td></tr>
<tr><td>E-mail</td> <td><input type="text" name="custMail" size="40" value="<?php echo $_POST["custMail"];?>"> </td></tr>
<tr><td>Διεύθυνση</td> <td><input type="text" name="custAddress" size="40" value="<?php echo $_POST["custAddress"];?>"> </td></tr>
<tr><td>Τηλέφωνο</td> <td><input type="text" name="custPhone" size="40" value="<?php echo $_POST["custPhone"];?>"> </td></tr>
</table>
<br/>
<table width="500px">
<tr><th colspan="2" align="center">Στοιχεία της Παραγγελίας</th></tr>
<tr><td>Προϊόν</td> <td><input type="text" name="prodName" size="40" value="<?php echo $_POST["prodName"];?>"> </td></tr>
<tr><td>Αριθμός Προϊόντων</td> <td><input type="text" name="numOfProd" size="40" value="<?php echo $_POST["numOfProd"];?>"> </td></tr>
</table>
<br/>
<table width="500px">
<tr><th colspan="2" align="center">Στοιχεία του Προμηθευτή</th></tr>
<tr><td>Επωνυμία</td> <td><input type="text" name="suplName" size="40" value="<?php echo $_POST["suplName"];?>"> </td></tr>
<tr><td>Διεύθυνση</td> <td><input type="text" name="suplAddress" size="40" value="<?php echo $_POST["suplAddress"];?>"> </td></tr>
<tr><td>Email</td> <td><input type="text" name="suplMail" size="40" value="<?php echo $_POST["suplMail"];?>"> </td></tr>
<tr><td>Τηλέφωνο</td> <td><input type="text" name="suplPhone" size="40" value="<?php echo $_POST["suplPhone"];?>"> </td></tr>
</table>
<br/>
<table width="500px">
<tr><th colspan="2" align="center">Στοιχεία Μεταφορικής Εταιρείας</th></tr>
<tr><td>Επωνυμία</td> <td><input type="text" name="carrierName" size="40" value="<?php echo $_POST["carrierName"];?>"> </td></tr>
<tr><td>Διεύθυνση</td> <td><input type="text" name="carrierAddress" size="40" value="<?php echo $_POST["carrierAddress"];?>"> </td></tr>
<tr><td>Email</td> <td><input type="text" name="carrierMail" size="40" value="<?php echo $_POST["carrierMail"];?>"> </td></tr>
<tr><td>Τηλέφωνο</td> <td><input type="text" name="carrierPhone" size="40" value="<?php echo $_POST["carrierPhone"];?>"> </td></tr>
</table>
<br/>
<input type="hidden" name="timestamp" value="<?php echo time(); ?>" />
<input type="submit" name="submit" class="button" value="Αποστολή" />
<input type="reset" name="reset" class="button" value="Επαναφορά"/>
</form>
<p></p>
<p></p>
<p></p>
</body>
What is usually done
then in the CSS you text-align:center the first div and text-align:left the other one.
The other way is to margin:0 auto the body. and put a width to the containing div
There is another way :