Closed Thread Icon

Preserved Topic: Tables and Spaces (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17270" title="Pages that link to Preserved Topic: Tables and Spaces (Page 1 of 1)" rel="nofollow" >Preserved Topic: Tables and Spaces <span class="small">(Page 1 of 1)</span>\

 
Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 09-03-2002 23:57

This code works fine but I was wondering if there might be a more elegant way to do this? It's a lot of code. Not hard, but just a lot...if not, ::shrugs:: This works fine. I'd just like the page to have to read as little code as possible to get the most/best results possible, if you know what I mean. Let me know if you'd rather have a page to view what this looks like and just view-source on it

Here's the table code!

code:
<table border="1">
<tr>
<th> </th>
<th>Distance from Sun(km)</th>
<th>Speed of Light (km/s)</th>
<th>Time Elapsed (min)</th>
<th>Possible Event</th>
</tr>
<tr>
<th>Mercury</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Venus</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Earth</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Mars</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Jupiter</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Saturn</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Uranus</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Neptune</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
<tr>
<th>Pluto</th>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
<td>&amp;nbsp;</td>
</tr>
</table>


[edit: made my "&amp;nbsp;" visible]

Oh, and one more thing: Is there a way to have the table fit the screen? I'd rather it get bigger if you have a bigger screen and smaller if you have a smaller screen, if you know what I mean....but I'd also like it to always print to one page...I hate it when I'm trying to print info and the tables go onto several pages sideways. It's a pain in the butt. lol.

Thanks in advance!
[edit: hehe..forgot to put the / in the "code" lol. I hate it when I do that...but now it looks amazingly wonderful, don'tcha think? ]

Genevieve Hokanson
Student Intern, GPB
http://einstein.stanford.edu
http://www.geocities.com/genevievescu/

[This message has been edited by Genevieve (edited 09-03-2002).]

[This message has been edited by Genevieve (edited 09-05-2002).]

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 09-04-2002 07:32

I don't think that you can have less code for a table like that, it looks fine just the way it is now.

If you want the table to fill the whole window's width, you can add width="100%" to the opening <table> tag and the table will always take up all the available space.

kuckus (cell #282)

Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 09-04-2002 18:14

Thanks Kuckus I never thought of that. Duh! ::hits forehead:: I'm such a duffus sometimes lol.

::sighs:: I guess I'll just have to live w/ long code then. Thanks anywho!

Genevieve<---that's me!!

Wowzers! o.O

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 09-05-2002 00:30

You need a colspan tag.

First I dunno about anyone else here and I could be wrong but the <th> tag is a bit old and not very used anymore <td> s work fine

so if you want something like that all you need to do is this (one row only) The space (nbsp) is needed in some older browsers to render properly. Also this method of formatting helps me with making sure all my tags are opened and closed properly (from your other post).

code:
<table border="1">
<tr>
<td>&nbsp;</td>
<td>Distance from Sun(km)</td>
<td>Speed of Light (km/s)</td>
<td>Time Elapsed (min)</td>
<td>Possible Event</td>
</tr>
<tr>
<td>Mercury</td><td colspan="4">&nbsp;</td>
</tr>
</table>







.:[ Never resist a perfect moment ]:.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 09-05-2002 00:32

oh shit of course my ASCII spaces didn't show up. but in those empty td tags I have & nbsp; (no space between the ampersand and the nbsp I had to put that there for visiblity)



.:[ Never resist a perfect moment ]:.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 09-05-2002 01:57

you mean "&amp;nbsp;"? =)

(hint: &amp;amp;nbsp

[edit: slimies]

[This message has been edited by Slime (edited 09-05-2002).]

Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 09-05-2002 17:46

Hiya! Okay, lots of stuff to respond to:

Bit: ROFL.... I just realized that all my own &amp;nbsp; didn't show up hehehe. So ya, all my empty <td></td>'s had that in there already. I'll try the colspan, thanks! As for the <th> tag, I looked it up in the table part of the w3school webbie, does it not work for newer browsers or something? Did I miss something? They make them real headers, with cool bolding and stuff you don't have to add yourself, so I like it but if for some reason it will be wrong later, I don't want to make more work for my boss once I'm no longer working here (I'll only be here until I grad from college) so I'll change it. Let me know.

Thanks for the help!

Genevieve<---that's me!!
Jinxed<--------that's me too(in description form)!!

Wowzers! o.O
Visit my cell! http://faq.ozoneasylum.com/FaqWiki/shownode.php?id=754&sortby=rating

Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 09-05-2002 17:58

Well, I tried it. Thanks anyway, not EXACTLY what I was looking for. I actually do want to have four separate, empty boxes. But let me know about the th vs td thing.

Thanks again!

Genevieve<---that's me!!
Jinxed<--------that's me too(in description form)!!

Wowzers! o.O
Visit my cell! http://faq.ozoneasylum.com/FaqWiki/shownode.php?id=754&sortby=rating

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 09-05-2002 20:16

As far as I know there's nothing wrong with using <th> tags, they are just <td>s with some extra formatting (bold and centered in most browsers).

kuckus (cell #282)

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 09-05-2002 21:33

Ack! Don't say "TH and TD are the same except for the way they look". That point of view comes from a "all that's important is the way it looks" way of thinking.

TH stands for Table Header. Use it when you want to give a table cell a header. This way, not only will visual browsers treat it as a header, but screen readers will treat it as a header (which significantly changes the way they read the table aloud to the user), and other types of user agents.

<th>...</th> may *look* the same as <td align="center"><b>...</b></td>, but the former holds more information about the structure of the document.

So use TH when appropriate; don't sacrifice the structure of your page just because it looks the same to *you*.

(If you don't like the way TH cells look, change it with CSS.)

Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 09-05-2002 22:03

Ah. ^^ Then I'll just stick w/ my th's and be happy. Thanks Slime! Always nice to learn something new.

Genevieve<---that's me!!
Jinxed<--------that's me too(in description form)!!

Wowzers! o.O
Visit my cell! http://faq.ozoneasylum.com/FaqWiki/shownode.php?id=754&sortby=rating

« BackwardsOnwards »

Show Forum Drop Down Menu