• Advertisement

Archived

This topic is now archived and is closed to further replies.

stupid html problem (html newb)

This topic is 5030 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to have two tables, one under the other, my html code works fine under Mozilla, but in explorer, the tables display one beside the other, here''s my html code:



Untitled Document
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">




<table width="100%" border="0" align="left" cellpadding="5" cellspacing="1" bordercolor="#3B6FA7" bgcolor="#006699">
      <tr> 
        <td width="659" height="10" align="left" valign="top" bordercolor="#FFFFFF" bgcolor="AAC0D7">News</td>
      </tr>
      <td height="129" width="659" bgcolor="#D6E1ED" align="left" valign="top">

Insert Featured PRODUCTS HERE

</td> </table> </div> <div> <table width="100%" border="0" align="left" cellpadding="5" cellspacing="1" bordercolor="#3B6FA7" bgcolor="#006699"> <tr> <td width="659" height="10" align="left" valign="top" bordercolor="#FFFFFF" bgcolor="AAC0D7"> News </td> </tr> <td height="129" width="659" bgcolor="#D6E1ED" align="left" valign="top">

Insert Featured PRODUCTS HERE

</td> </table> </div> </body> </html>
can anybody help?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I would say use a <br /> tag between the tables, or since you are using the <div> tags use a styles to maneuver the enclosed tables to where ever you want them.

<a href="www.w3schools.com">This</a> is a decent reference point.

Share this post


Link to post
Share on other sites
Just nest the two tables inside a third, like so:


<table>
<tr><td>

<table>
<tr><td>
// TOP TABLE HERE
</td></tr>
</table>

</td></tr>
<tr><td>

<table>
<tr><td>
// BOTTOM TABLE HERE
</td></tr>
</table>

</td></tr>
</table>

Share this post


Link to post
Share on other sites
Please don't nest tables. Nesting tables is evil. It slows down your page. A simple <br> is fast as hell. Displaying a table requires the browser to do a lot of calculations (how big is it, how many columns are used, how wide is each column, ...) and everything you put in a table can only be displayed once all the calculations are done. The less tables you use, the better.

---
tommy online: http://users.pandora.be/tommycarlier

[edited by - Tommy Carlier on April 15, 2004 3:43:22 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You usually use tables for the page to scale nicely when the window changes size etc. The amount of calculations that need to be done aren''t that much when we are all running with CPUs at 1GHz+.

- Damage Incorporated

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
You usually use tables for the page to scale nicely when the window changes size etc. The amount of calculations that need to be done aren''t that much when we are all running with CPUs at 1GHz+.

- Damage Incorporated


I didn''t say: don''t use tables. I said nesting tables is not good. And we''re not all running CPUs at 1GHz+ or have a superfast cable connection. Actually, it''s not only the amount of calculations that is important, but also the measuring of the content inside the table-cells. Haven''t you ever noticed that the content of a table is only displayed when the whole table is loaded? Or (if the browser does show content) that it jumps around? If you use <DIV>s and stylesheets, your page will show up a lot faster. Take a look at http://users.pandora.be/tommycarlier/eu (my site). You see a structure that other people would use tables for. Look at the source-code: the main content is actually displayed before the left-column, which is good: people visit websites for the content. Also notice that you won''t find any style in the source code: the description of what goes where and how does it look is inside the CSS-file, which is only loaded once, and cached by the browser => faster website.

---
tommy online: http://users.pandora.be/tommycarlier

Share this post


Link to post
Share on other sites
quote:
Original post by yves032784

<table width="100%" border="0" align="left" cellpadding="5" cellspacing="1" bordercolor="#3B6FA7" bgcolor="#006699">
<tr>
<td width="659" height="10" align="left" valign="top" bordercolor="#FFFFFF" bgcolor="AAC0D7">News</td>
</tr>
<td height="129" width="659" bgcolor="#D6E1ED" align="left" valign="top">

Insert Featured PRODUCTS HERE

</td>

</table>



The format is

table
tr
td /td
/tr
tr
td /td
/tr
/table


You have missed out some elments (second row tr's), also you specify a fixed width for the table cells but use 100% for the table, there is no need for both. Fixed widths can cause visual imperfections when viewed on differeent screen sizes.

Tables are evil, avoid them if at all possible for layout. (see www.w3.org for html specs). I'd go for CSS rather than using attributes its much cleaner and quicker to write.

Jay


[edited by - Jason Zelos on April 15, 2004 7:34:15 AM]

Share this post


Link to post
Share on other sites

  • Advertisement