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!

HTML PROGRAM HAS TOO MANY SPACES

Status
Not open for further replies.

samesale

Programmer
Sep 15, 2003
133
US
I have created the following HTML program. However, I cannot seem to close the tables close together. That is, the blue table with red heading is too far away from the yellow table. I tried many alignments, but they did not work. Please help. Thanks.

<htmt>
<head>
</head>
<body>

<table width =&quot;40%&quot; border=&quot;0&quot; bordercolor=&quot;blue&quot; >
<tr><td bgcolor=&quot;white&quot; align=&quot;left&quot; valign=&quot;top&quot; ><b>

<Font size=&quot;2&quot; color=&quot;red&quot;>
TO SELL,<br> CLICK THE APPROPRIATE<br> link below:

<table border=&quot;5&quot; bgcolor=&quot;blue&quot; width=&quot;180&quot;><b>
<tr><td><A HREF=&quot;cgi-bin/bookc.cgi&quot;><font color=&quot;white&quot; size=1> <b> USED TEXTBOOKS</a></td></tr>
</td></tr> </table>

<td><font color=&quot;red&quot; size=&quot;4&quot;><b>ON THIS WEBSITE, YOU CAN:</font><br>

<table border=&quot;6&quot; bgcolor=&quot;yellow&quot; width=&quot;330&quot;><td><FONT COLOR=&quot;blue&quot;><b>
<dir>
<li/> Texbooks</dir><br>
</FONT></td></tr></table><br>

<td align=&quot;center&quot; valign=&quot;top&quot;>

<Font size=&quot;2&quot; color=&quot;green&quot;><b>
TO BUY,<br> CLICK THE APPROPRIATE<br> link below:</b>

<table border=&quot;5&quot; bgcolor=&quot;RED&quot; width=&quot;180&quot;><b>
<tr><td><A HREF=&quot;cgi-bin/booksearch.cgi&quot;><font size=1 color=&quot;WHITE&quot;><b>USED TEXTBOOKS</a> </td></tr>
</table></td><br>

<tr><td align=&quot;left&quot;>

<table border=&quot;7&quot; bgcolor=&quot;white&quot; width=&quot;600&quot;><tr><td><FONT COLOR=&quot;green&quot; size=&quot;5&quot;><b>
Please click the appropriate link on the left: </font><font size=&quot;4&quot; color=&quot;blue&quot;>blue,</font> and <font size=&quot;4&quot; color=&quot;red&quot;> red,.</font> </b></FONT></td></tr></table><br>


</table>
</body>
</html>
 
Huh, first of all, check some tutorials on for some insight into html. Every element you open, must get closed (ok, in html there are some exceptions but there is a good practice to close all the elements). Your code has numerous errors, from opening tag (<htmt> instead of <html>) on. One of the biggest errors you are making are tables. Tables must be constructed in the following way:

<table>
<tr>
<td> FIRST COL CONTENT </td>
<td> SECOND COL CONTENT </td>
</tr>
<tr>
<td colspan=&quot;2&quot;> JOINED COLUMNS SECOND ROW </td>
</tr>
</table>

There mustn't be anything between the <table> <tr> and <td> tags. Any content (including other html tags) must be used in a td and no sooner. Everything has to be closed in a proper way (seen above) as well. To speculate on your problem, you had a huge table in the second row of your bigger table that stretched the content of the first column and thus pushed all the rest further to the right. I used colspan=&quot;3&quot; (instructing the cell in the second row to span accross three cells) and I suppose that was what you were aiming for. Here is the code:
Code:
<html>
<head>
<title>Tables</title>
</head>
<body>

<table width =&quot;40%&quot; border=&quot;0&quot; bordercolor=&quot;blue&quot;>
 <tr>
  <td  bgcolor=&quot;white&quot; align=&quot;left&quot; valign=&quot;top&quot;>
   <font  size=&quot;2&quot; color=&quot;red&quot;><b>TO SELL,<br /> CLICK THE APPROPRIATE<br /> link below:</b></font>
   <table border=&quot;5&quot; bgcolor=&quot;blue&quot;  width=&quot;180&quot;>
    <tr>
     <td>
      <A HREF=&quot;cgi-bin/bookc.cgi&quot;><font color=&quot;white&quot; size=1>USED TEXTBOOKS</a>
     </td>
    </tr>
   </table>
  </td>
  <td><font color=&quot;red&quot; size=&quot;4&quot;><b>ON THIS WEBSITE, YOU CAN:</b></font><br />  
   <table border=&quot;6&quot; bgcolor=&quot;yellow&quot; width=&quot;330&quot;><td><FONT COLOR=&quot;blue&quot;>
    <tr>
     <td>
      <ul>
       <li>Texbooks</li>
      </ul>
      <br />
     </td>
    </tr>
   </table>
   <br />
  </td>
  <td align=&quot;center&quot; valign=&quot;top&quot;>
   <Font size=&quot;2&quot; color=&quot;green&quot;><b>TO BUY,<br /> CLICK THE APPROPRIATE<br /> link below:</b>
   <table border=&quot;5&quot; bgcolor=&quot;RED&quot; width=&quot;180&quot;>
    <tr>
     <td>
      <A HREF=&quot;cgi-bin/booksearch.cgi&quot;><font size=1 color=&quot;WHITE&quot;><b>USED TEXTBOOKS</b></a>
     </td>
    </tr>
   </table>
  </td>
  <br />
 </tr>
 <tr>
  <td align=&quot;center&quot; colspan=&quot;3&quot;>
   <table border=&quot;7&quot; bgcolor=&quot;white&quot; width=&quot;600&quot;>
    <tr>
     <td><b><FONT COLOR=&quot;green&quot; size=&quot;5&quot;>Please click the appropriate link on the left: </font><font size=&quot;4&quot; color=&quot;blue&quot;>blue,</font> and <font size=&quot;4&quot; color=&quot;red&quot;> red,.</font> </b></td>
    </tr>
   </table>
   <br />
  </td>
 </tr>
</table>
</body>
</html>
 
Thank you. It worked. I also appreciate you suggesting a site. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top