XHtml Help

Associate
Joined
12 Jun 2005
Posts
836
Location
Newcastle
Right, doing a website for my Part Time Degree, cannot get this page to go through the validator.

Code:
<form method="post" action="mailto:[email protected]">
		<font face="verdana" size="2" color="black">
		<table width="641" align="center">	
						
					  <tr><td>First Name</td><td><input type="text" name="First_Name" size="15" maxlength="25" value="" /></td>

                                           <td>Second Name</td><td><input type="text" name="Second_Name" size="15" maxlength="25" value="" /></td></tr>

					    <tr><td>Address Line 1</td><td><input type="text" name="Address1" size="25" maxlength="25" value="" /></td>

					     <td>Address Line 2</td><td><input type="text" name="Address2" size="25" maxlength="25" value="" /></td></tr>

					      <tr><td>Address Line 3</td><td><input type="text" name="Address3" size="25" maxlength="25" value="" /></td>

					       <td>Postcode</td><td><input type="text" name="Postcode" size="7" maxlength="7" value="" /></td></tr>

					        <tr><td>Telephone Number</td><td><input type="text" name="Telephone" size="11" maxlength="11" value="" /></td>

					         <td>Mobile Number</td><td><input type="text" name="Mobile" size="11" maxlength="11" value="" /></td></tr>

					          <tr><td>Email Address</td><td><input type="text" name="Email" size="30" maxlength="50" value="" /></td></tr>

					           <tr>
						    <td>Nature Of Enquiry</td>
						     <td>
						      <select name="Equiry">
							<option value="sales">Sales</option>
							<option value="general">General</option>
							<option value="directions">Directions</option>
						       </select>
						      </td>
						   </tr>
						   <tr>
						      <td>Enquiry</td>
						      <td>
						        <textarea rows="5" cols="20"></textarea>
						      </td>
						   </tr>
		</table>
						
		
																	
		<table width="80%" align="center">
		<tr>
		<td align="center">
			<input type="submit" value="Submit" />
			<input type="reset" value="Reset" />
		</td>
		</tr>
		
		
		</table>
		</font>
		</form>

Basically it doesnt like the table tags. Any ideas? :confused: :mad:
 
toosepin said:
Can you post the whole page please? I need to know the doctype :)

Cheers mate, driving me nuts, its only this one page that wont pass!

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html>
	
        <head>
        <title>PD Cars - Contact Us</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        </head>

	<body background="..\Images\background.jpg">
		<br/>
		<br/>
		<br/>
		<table border="0" align="center" width="600" cellpadding="-10" cellspacing="-1">
					<tr>
					<td><a href="..\Home\home.html"><img src="..\Images\home.gif" alt="Home" border="0" /></a></td>				
					<td><a href="..\About\About.html"><img src="..\Images\about_us.gif" alt="About Us" border="0" /></a></td>		
					<td><a href="..\Stock_List\stock_list.html"><img src="..\Images\stock_list.gif" alt="Stock List" border="0" /></a></td>	
					<td><a href="..\Contact_Us\contact_us.html"><img src="..\Images\contact_us.gif" alt="Contact Us" border="0" /></a></td>	
					<td><a href="..\Links\links.html"><img src="..\Images\links.gif" alt="Links" border="0" /></a></td>
					<td><img src="..\Images\logo.gif" alt="PD Cars" /></td>
					</tr>
		</table>

		<table align="center" width="641">
					
					<tr>
					<td align="center"> 
					<font face="verdana" size="2" color="black">
					
					Please use the below form to contact us, this maybe with regards to a car or just a general 
					enquiry. We aim to respond the same working day.
					
					</font>
					</td>
					</tr>
					
		</table>			
					
					
					
							
		<form method="post" action="mailto:[email protected]">
		<font face="verdana" size="2" color="black">
		<table width="641" align="center">	
						
					  <tr><td>First Name</td><td><input type="text" name="First_Name" size="15" maxlength="25" value="" /></td>

                                           <td>Second Name</td><td><input type="text" name="Second_Name" size="15" maxlength="25" value="" /></td></tr>

					    <tr><td>Address Line 1</td><td><input type="text" name="Address1" size="25" maxlength="25" value="" /></td>

					     <td>Address Line 2</td><td><input type="text" name="Address2" size="25" maxlength="25" value="" /></td></tr>

					      <tr><td>Address Line 3</td><td><input type="text" name="Address3" size="25" maxlength="25" value="" /></td>

					       <td>Postcode</td><td><input type="text" name="Postcode" size="7" maxlength="7" value="" /></td></tr>

					        <tr><td>Telephone Number</td><td><input type="text" name="Telephone" size="11" maxlength="11" value="" /></td>

					         <td>Mobile Number</td><td><input type="text" name="Mobile" size="11" maxlength="11" value="" /></td></tr>

					          <tr><td>Email Address</td><td><input type="text" name="Email" size="30" maxlength="50" value="" /></td></tr>

					           <tr>
						    <td>Nature Of Enquiry</td>
						     <td>
						      <select name="Equiry">
							<option value="sales">Sales</option>
							<option value="general">General</option>
							<option value="directions">Directions</option>
						       </select>
						      </td>
						   </tr>
						   <tr>
						      <td>Enquiry</td>
						      <td>
						        <textarea rows="5" cols="20"></textarea>
						      </td>
						   </tr>
		</table>
						
		
																	
		<table width="80%" align="center">
		<tr>
		<td align="center">
			<input type="submit" value="Submit" />
			<input type="reset" value="Reset" />
		</td>
		</tr>
		
		
		</table>
		</font>
		</form>

 		
		
	     	
		
		<table border="0" align="center" width="641">
					<tr>
					<td align="center"> 
					<font face="verdana" size="2" color="black">
					
					<a href="..\Home\home.html">Home</a>				
					<a href="..\About\About.html">About Us</a>		
					<a href="..\Stock_List\stock_list.html">Stock List</a>	
					<a href="..\Contact_Us\contact_us.html">Contact Us</a>
					<a href="..\Links\links.html">Links</a>
					</font>
						
					<p>
    					<a href="http://validator.w3.org/check?uri=referer"><img
        				src="..\images\valid.gif" border="0"
        				alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
  					</p>
					
					</td>
					</tr>
					
		</table>
		
		
	</body>
</html>

Btw cant use CSS or anything, needs to be a static website. No java etc.
 
i'm pretty sure you can't use font in xhtml? you should be using css for that. infact you should lose the tables and use css for the layout too. :p

edit: with regards no css? that's crazy. it's doesn't have to be in an external file, you can include it in the <head> of your file. :)
 
Remove the <font> tags surrounding the <table>. <font> is an inline element, and cannot contain a block level element such as a <table>.

As marc2003 says, use CSS in a <style type="text/css"></style> block in your <head>.
 
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>
<head>

	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>PD Cars - Contact Us</title>

</head>
<body background="..\Images\background.jpg">
		
<table border="0" align="center" width="600" cellpadding="-10" cellspacing="-1">
  <tr>
   <td><a href="..\Home\home.html"><img src="..\Images\home.gif" alt="Home" border="0" /></a></td>				
   <td><a href="..\About\About.html"><img src="..\Images\about_us.gif" alt="About Us" border="0" /></a></td>		
   <td><a href="..\Stock_List\stock_list.html"><img src="..\Images\stock_list.gif" alt="Stock List" border="0" /></a></td>	
   <td><a href="..\Contact_Us\contact_us.html"><img src="..\Images\contact_us.gif" alt="Contact Us" border="0" /></a></td>	
   <td><a href="..\Links\links.html"><img src="..\Images\links.gif" alt="Links" border="0" /></a></td>
   <td><img src="..\Images\logo.gif" alt="PD Cars" /></td>
  </tr>
</table>

<table align="center" width="641">
  <tr>
    <td align="center"> 
    <font face="verdana" size="2" color="black">
    Please use the below form to contact us, this maybe with regards to a car or just a general 
    enquiry. We aim to respond the same working day.
    </font>
    </td>
  </tr>
</table>			

<form method="post" action="mailto:[email protected]">
<table width="641" align="center">	
  <tr>
    <td>First Name</td>
    <td><input type="text" name="First_Name" size="15" maxlength="25" value="" /></td>
    <td>Second Name</td><td><input type="text" name="Second_Name" size="15" maxlength="25" value="" /></td>
  </tr>
  <tr>
    <td>Address Line 1</td>
    <td><input type="text" name="Address1" size="25" maxlength="25" value="" /></td>
    <td>Address Line 2</td><td><input type="text" name="Address2" size="25" maxlength="25" value="" /></td>
  </tr>
  <tr>
    <td>Address Line 3</td>
    <td><input type="text" name="Address3" size="25" maxlength="25" value="" /></td>
    <td>Postcode</td>
    <td><input type="text" name="Postcode" size="7" maxlength="7" value="" /></td>
  </tr>
  <tr>
    <td>Telephone Number</td>
    <td><input type="text" name="Telephone" size="11" maxlength="11" value="" /></td>
    <td>Mobile Number</td><td><input type="text" name="Mobile" size="11" maxlength="11" value="" /></td>
  </tr>
  <tr>
    <td>Email Address</td>
    <td><input type="text" name="Email" size="30" maxlength="50" value="" /></td>
  </tr>
  <tr>
    <td>Nature Of Enquiry</td>
    <td>
    <select name="Equiry">
    <option value="sales">Sales</option>
    <option value="general">General</option>
    <option value="directions">Directions</option>
    </select>
    </td>
  </tr>
  <tr>
    <td>Enquiry</td>
	<td><textarea rows="5" cols="20"></textarea></td>
  </tr>
  </table>

<table width="80%" align="center">
  <tr>
    <td align="center">
    <input type="submit" value="Submit" />
    <input type="reset" value="Reset" />
    </td>
  </tr>
</table>
</form>

<table border="0" align="center" width="641">
  <tr>
    <td align="center"> 
    <font face="verdana" size="2" color="black">
    <a href="..\Home\home.html">Home</a>				
    <a href="..\About\About.html">About Us</a>		
    <a href="..\Stock_List\stock_list.html">Stock List</a>	
    <a href="..\Contact_Us\contact_us.html">Contact Us</a>
    <a href="..\Links\links.html">Links</a>
    </font>
    <p>
    <a href="http://validator.w3.org/check?uri=referer"><img src="..\images\valid.gif" border="0" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
    </p>
    </td>
  </tr>
</table>

</body>
</html>

There you go, now valid. Font is an inline element - it should be used within parent elements such as TD
 
Augmented said:
Remove the <font> tags surrounding the <table>. <font> is an inline element, and cannot contain a block level element such as a <table>.

As marc2003 says, use CSS in a <style type="text/css"></style> block in your <head>.

Beaten! :P
 
Thats great, but now the font for the labels on the form are in times new roman not verdanna, is it a case of a font tag for each label? I cannot use CSS, a constraint of the assignment.
 
Last edited:
_-J-_ said:
Thats great, but now the font for the labels on the form are in times new roman not verdanna. I cannot use CSS, a constraint of the assignment.
That a pretty stupid constraint to make, but I guess you're stuck with it. Yes, what you'll have to do is surround every bit of label text with the relevant <font> element.

It'll take a while, be inflexible, and add loads of bloat to your code (hence why CSS would be better).
 
Last edited:
Augmented said:
That a pretty stupid constraint to make, but I guess you're stuck with it. Yes, what you'll have to do is surround every bit of label text with the relevant <font> element.

It'll take a while, be inflexible, and add loads of bloat to your code (hence why CSS would be better).

Yup tell me bout about it, already had this discussion with a web developer at work and a argument with my tutor. Next assignment can use Java, CSS etc.

Cheers tho :)
 
don't relative addresses need to be like this...

./images/img.jpg

not like this...

.\images\img.jpg
 
Back
Top Bottom