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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table ? - Need fixed cell height/width

Status
Not open for further replies.

Nate1749

Programmer
Nov 1, 2002
204
US
First off, is it better to use %'s or a set number of pixels when defining any size in a table/cell/row?

I'm trying to make a small 2x2 table setup. The top row is completely black.
Row 2 - Cell 1, is completly white (having links here). Row 2 - Cell 2, is completly black, but it has an image aligned to the left so it's a smooth curve.

The problem I'm having is it looks perfectly fine on my resolution when the screen is maximized, however, if I make the screen a window and make it smaller, the cells start to become taller in height making everything look wrong. Is there a way to prevent this?

I tried using the nowrap command, but that didn't seem to do anything.

<TABLE WIDTH=&quot;100%&quot; HEIGHT=&quot;8%&quot; BORDER=&quot;0&quot; CELLPADDING=&quot;0&quot; CELLSPACING=&quot;0&quot;>


<TR HEIGHT=&quot;20&quot;>
<TD bgcolor=&quot;000000&quot; nowrap></TD>
<TD bgcolor=&quot;000000&quot; nowrap></TD>
</TR>

<TR HEIGHT=&quot;20&quot;>
<TD WIDTH=350 ALIGN=LEFTT><font face=&quot;verdana&quot; size=&quot;2&quot; color=&quot;000000&quot; nowrap>
<A HREF=&quot;main.htm&quot;>Main</A> |
<A HREF=&quot;contact.htm&quot;>Contact Us</A> |
<A HREF=&quot;about.htm&quot;>About</A> |
<A HREF=&quot;help.htm&quot;>Help</A>

</TD>
<TD bgcolor=&quot;000000&quot; width=500><IMG SRC=&quot;images/curve.gif&quot; align=&quot;left&quot; border=&quot;0&quot;
hspace=&quot;0 width=&quot;50&quot; height=&quot;20&quot; nowrap></TD>
</TR>
</TABLE>

-Nate
 
Whenever you use percentages to define table & cell widths, you're actually creating a dynamic table. This is because percentages are based on viewable screen widths/heights that will change for each resolution ratio (640x480, 800x600, 1024x768, etc.). The same percentage table specifications will look different for each of these screen resolutions.

So, if you must have absolute fixed sizes then definately use pixel values rather than pecentages. There's always a better way...
 
i thought %'s were more versatile in that sense, however, after viewing many webpages I noticed that they all use fixed #'s rather than %'s. I also noticed that they don't use ALL CAPS when doing tags; it's been quite a few years since I've been into HTML, but that was the standard back then, seems times have changed.
 
It's good practice now not to use CAPS at all as it's not XHTML compliant, in XHTML all tags must be lowercase.
Likewise, all attributes should be enclosed in &quot;speechmarks&quot; in order to be XHTML compliant. Theres plenty more rules to follow, visit to get the lowdown.

i.e.
<TD WIDTH=350 ALIGN=LEFTT> = <td width=&quot;350px&quot; align=&quot;left&quot;>

I guess it's just a good habit to get into, and it will certainly make life easier if you ever need to incorporate XML as XML and XHTML follow similar (same?) guidelines.

Pete :O)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top