Jump to content

How Do I Position Forms Within A Table Using Css.


mckenzie
 Share

Recommended Posts

Hi all, I'm trying to move a form to the top of my table. I apologise in advance if this is covered in the tutorial as i have been looking. I am also aware that many programmers feel using tables and css for layout reasons can kind of conflict.I'm using tables for the basic layout of my website. The include for the Main body of the page contains just a simple form:

	<table id="colormain" border="0" width="1265" height="500">		<tr>			<td width="0">			<form action="welcome.php" id="form" method="post"><fieldset><legend>Goalkeeper</legend><p><label for="name">Name</label> <input type="text" id="name" /></p><p><label for="e-mail">E-mail</label> <input type="text" id="e-mail" /></p><p class="submit"><input type="submit" value="Submit" /></p></fieldset></form> 					</td>					</tr>			</table>

The main page is made up of a bucket load of tables:

<html><head><link rel="stylesheet" type="text/css" href="Stylesheet1.css" /><title>PROJECT</title></head>	<body>	<table border="1">		<tr>			<td colspan="2">				<table border="1">					<tr>						<td>						<?php include("Includes/header.php"); ?>						</td> 					</tr>				</table>			</td>		</tr>					<tr>			<td width="100">				<table border= "1">				<tr>					<td>					<?php include("Includes/leftnavbar.php"); ?>					</td> 				</tr>				</table>  			</td>   			<td width="1280">				<table border = "1" >				<tr>					<td>					<?php include("Includes/mainbody.php"); ?>					</td>				</tr>				</table>						</td>			</tr>	</table></body></html>

So my question is this. How do I position my form at the top (generally position it) of the 'Main body' includes table, using my css stylesheet. Thanks

Link to comment
Share on other sites

Nope, still haven't mastered it.I've taken the Form out of the Include and put it in my Index page but its elements are still getting their info from my css stylesheet. The Form is still at the centre of the table, even with valign, margin-top all trying to get it to the top.Surely there is a standard way of moving a form around a table? Getting it to the top of the table or cell its in. I know I shouldn't of used tables to construct the layout of my website but thats the way i was taught. Sorry for the persistent late replies.

Edited by mckenzie
Link to comment
Share on other sites

There are ways to move elements around, there's nothing specific about forms and tables. Try the vertical-align CSS property for the table cell that the content is in. Tables are vertically centered by default, other elements are not. A div for example wouldn't center it in the middle, it would start it at the top.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...