ok, so I have this html form

  <head> <title> SUBMIT FORM </title> 
  <link type="text/css" rel="stylesheet" href="prva_strana.css" />

	 <form action="druga_strana.php" method="post">
<div> <label for="Fname"> First Name: </label> <input type="text" name="Fname"> </div>
<div> <label for="Lname"> Last Name: </label> <input type="text" name="Lname"> </div>
<div> <label for="Uname"> User Name: </label> <input type="text" name="Uname"> </div>
<div> <label for="Email"> Email: </label> <input type="text" name="Email"> </div>
<div> <label for="password"> Password: </label> <input type="password" name="pass"> </div>
<div> <label for="Cpass"> Confirm Password: </label> <input type="password" name="Cpass"> </div>

<div class="actions"> <input type="submit" name="submit" value="Submit">
	<input type="reset" name="reset" value="Reset all"> </div>



and I have this CSS

body {
	font: small bold Verdana, Arial, Helvetica, Geneva, sans-serif;
form div {
	margin 0 0 0.25ex 0;
	clear: left;
label {
	width: 6em;
	display: block;
	float: left;
	font-weight: bold;
	padding-right: 1.5em;
	text-align: center;
form div.actions {
	margin-left: 6em;
	padding-left: 1.5em;

what I need is to CENTER WHOLE FORM in the middle of a page, if I wrap everything in ONE div and put align="center" it will only center the INPUT fields, but I need everything ( first name, last name, pass ... ) to be centered with the input fieds..

help anyone?

Recommended Answers

All 3 Replies

Member Avatar for rajarajan2017

Add to stylesheet

body {
	margin:50px 0px; padding:0px;

tried it.. Got the same result, First name, Last name... etc on the left, and input field on center :(

I know I can do this form with tables, but I would like to avoid tables by any means :)

solved it :) .. tnx, margin was very helpful !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.