Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Position of form submit button 1

Status
Not open for further replies.

kpetursson

Programmer
Jan 28, 2002
313
US
I want to position two buttons for my form.
I would like a little space between then and for them to be centered on the form.
I have the 'text-align:center;' on the form, but the buttons do not seem to care.

Any help is greatly apriciated.

Kevin Petursson
--
"Everyone says quotable things everyday, but their not famous... so nobody cares."... Some Person
 
It depends on what surrounds your form? and centered in relation to what?

Could we perhaps see some code? not of the form itself but of the layout portion, i.e is it in a Table? is it in a DIV? is just sitting there in the page etcc...

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
This should work:

Code:
<div style="text-align:center;">
   <input type="button" ... style="margin-right: 10px;">
   <input type="button" ... >
</div>

If it doesn't work, maybe you have some other styling in your CSS that is causing problems?

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
here is the code I'm working on...

Code:
<html lang="en">
<head>
<title>Toy Lending</title>
<style type="text/css">
<!--

body {
	background-color: white;
}

input {
	display: block;
	width: 150px;
	float: left;
	margin-bottom: 10px;
	background-color: #eeffee;
	border-color: #3fff90;
}

label {
	display: block;
	width: 175px;
	float: left;
	margin-bottom: 10px;
	text-align: right;
	padding-right: 20px;
	font-weight: bold;
}

form {
	background-image: url('grad.jpg');
	background-repeat: repeat-y;
	width: 400px;
	border-width: 2;
	border-color: #07d55e;
	border-style: solid;
	text-align: center;
}

input#sign-out, input#clear, input#return{
	background-color: #ffffcc;
	border-color: #ffffaa;
	width: 100px;
	
}
input#sign-out{
	background-color: #ffffcc;
	border-color: #ffffaa;
	width: 100px;
	
}

div.title{
	font-size: 200%;
}

br {
	clear: left;
}
button{
}
-->
</style>
</head>
<body>
<FORM METHOD="post" ACTION="lending.php?choice=Verify_order">
<div class="title">Toy Lending</div><br />
<LABEL for="member_phone">Home Phone # : </LABEL><INPUT TYPE="text" ID="member_phone" NAME="member_phone"><br />
<LABEL for="toy1">Toy Number : </LABEL><INPUT TYPE="text" ID="toy1" NAME="toy1"><br />
<LABEL for="toy2">Toy Number : </LABEL><INPUT TYPE="text" ID="toy2" NAME="toy2"><br />
<LABEL for="toy3">Toy Number : </LABEL><INPUT TYPE="text" ID="toy3" NAME="toy3"><br />
<LABEL for="toy4">Toy Number : </LABEL><INPUT TYPE="text" ID="toy4" NAME="toy4"><br />
<LABEL for="toy5">Toy Number : </LABEL><INPUT TYPE="text" ID="toy5" NAME="toy5"><br />
<INPUT TYPE="button" id="clear" NAME="clear" VALUE="Clear Form">
<INPUT TYPE="button" id="sign-out" NAME="sign-out" VALUE="Sign Out">
<br />
</FORM>
</body>
</html>

Kevin Petursson
--
"Everyone says quotable things everyday, but their not famous... so nobody cares."... Some Person
 
It is the "float:left" and "display:block" applied to all inputs that is causing the problem. Remove this from generic inputs, and apply it using a class, then you'll be sorted.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thank you BillyRay!

That fixed it. I didn't know you could have an element called as a class, and id both. I don't see why there should be a reason that you could not do this, it just hadn't occured to me.

Kevin Petursson
--
"Everyone says quotable things everyday, but their not famous... so nobody cares."... Some Person
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top