Forum Moderators: mack

Message Too Old, No Replies

Netscape Problem with Tables

Show up fine with explorer, not with netscape

         

CalArch90

4:20 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



Hi,

I was wondering if anyone has ever had problems with table heights or widths appearing incorrectly with the Netscape browser.

In my case, I've set up a menu to the left with cells and text inside. On explorer the heights show up correctly at 30px the way I intended. When I use the netscape browser, the cells end up being more like 35px in height. I'm using a standard table setup:

<table>
<tr>
<td>text here</td>
</tr>
<tr>
<td>more text here</td>
</tr>
</table>

It's not a major problem, but it affects how the menu lines up with an image to the right which is 120px in height. I would like the layout to appear the same in both browsers (it is also o.k. with Opera).

Netscape browser version is 7.1. Has anyone had this happen to them?

robert adams

5:35 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



post the html in question so we can take a look at it.
thanks,
robert

AWildman

6:16 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



Try setting table tr td{margin: 0px; padding: 0px;} to see if that helps. Its probably an issue of default padding in netscape.

CalArch90

11:06 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



Here is the script. If you notice on IE it has the text in the middle vertically, but in Netscape the bottom margin is larger, so the height ends up being more than 30px.

<html>
<head>

<style>
A.menulink {
display: block;
width: 100%;
height: 30px;
text-align: left;
Padding-Left : 5px;
Padding-Top : 7px;
text-decoration: none;
font-family: arial;
font-size: 12px;
line-height: 14px;
font-weight: bold;
color: #ffffff;
background-color:#999999;
border-left: solid 0px #ffffff;
border-right: solid 0px #ffffff;
border-top: solid 1px #ffffff;
border-bottom: solid 0px #ffffff;
}

A.menulink:hover {
border-left: solid 0px #ffffff;
border-right: solid 0px #ffffff;
border-top: solid 1px #ffffff;
border-bottom: solid 0px #ffffff;
background-color:#666666;
}
</style>

</head>

<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">

<table height="120" width="150" cellpadding=0 cellspacing=0 border=0>
<tr valign=top>
<td>

<table border="0" width="150" height="120" cellpadding=0 cellspacing=0>
<tr>
<td><a href="http://www.somesite.html" class="menulink">Text1</a></td>
</tr>
<tr>
<td><a href="http://www.somesite.html" class="menulink">Text2</a></td>
</tr>
<tr>
<td><a href="http://www.somesite.html" class="menulink">Text3</a></td>
</tr>
<tr>
<td><a href="http://www.somesite.html" class="menulink">Text4</a></td>
</tr>
</table>

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

</body>
</html>

I tried setting the tr td{margin: 0px; padding: 0px;} but it only affected the top and left, not the bottom margin which is the source of the problem.

iamlost

12:58 am on Jan 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The browsers are showing differences in line-height. This is common as the browsers interpret font-size differently and so line-height (which is number/percentage times font-size).

Also "line-height: 14px;" is improper syntax: it should be a percentage or a number: in this case 1.4 or 140% would be equivalent. Take out the line and see what I mean - compliant browsers will ignore that line as it is now (with "px").

iamlost

1:04 am on Jan 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Further:

Try dropping the padding-top and setting "line-height: 2.5;".

CalArch90

2:21 am on Jan 16, 2004 (gmt 0)

10+ Year Member



That worked nicely. I used "line-height: 2.4;". Thank you very much for your help.

g1smd

5:42 pm on Jan 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Run that code through [jigsaw.w3.org...] and see what you get. I am sure it will result in an error message.

>> Also "line-height: 14px;" is improper syntax: it should be a percentage or a number: in this case 1.4 or 140% would be equivalent.

>> Try dropping the padding-top and setting "line-height: 2.5;"

As far as I know, all numbers in CSS must have units of px, pt, em, %, or # stated.

Only the number 0 does not need units.

iamlost

2:29 am on Jan 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> g1smd:

Generally you are correct; specifically, in this instance, you are not.

First: from w3c (bold is my emphasis):


'line-height'
Value: normal ¦ <number> ¦ <length> ¦ <percentage> ¦ inherit
......
<number>
The computed value of the property is this number multiplied by the element's font size. Negative values are illegal. However, the number, not the computed value, is inherited.


The three rules in the example below have the same resultant line height:

DIV { line-height: 1.2; font-size: 10pt } /* number */
DIV { line-height: 1.2em; font-size: 10pt } /* length */
DIV { line-height: 120%; font-size: 10pt } /* percentage */

The <number> attribute is any positive or negative integer or real number without unit identifier. The number range may be restricted - i.e. line-height is restricted to non-negative values.

The <length> attribute requires a unit identifier and can be positive/negative, integer/real unless specifically limited in some instance.

Second: I always run my code through both css and html validators prior to submitting here and note any warnings/errors. In this instance my code validated as valid xhtml 1.0 strict and valid css2. Note: I run my tests with css as a separate linked file to simplify valdation.

CalArch90

11:54 pm on Jan 25, 2004 (gmt 0)

10+ Year Member



Hi,

I hadn't checked this thread in a while, so I didn't realize there were more posts.

The change improved the appearance of the menu in Netscape considerably, but it is not quite perfect. Things don't line up as they do in IE or Opera. The space at the bottom is still slighltly larger in Netscape. Is there anything else that could be done to improve on this? From what I understand, ideally, pages should appear the same in all browsers.

An additional problem I'm having with Opera is that I keep getting the message: "Could not connect to remoter server" for my footer. I use iframes, so could this be the cause? My other iframes are appearing o.k., however (I have the most recent version of Opera which should support frames). Also some of my images appear, while others don't. What causes this?

tedster

12:08 am on Jan 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ideally, pages should appear the same in all browsers

That ideal isn't going to happen in reality for quite a while, if ever. I just aim for "pages should look good in all browsers".

In particular, pixel perfect control of container widths and heights goes out the window when text enters the picture. Browsers come complete with their own sets of "core fonts" and these fonts are not identical, they're just close. And just when you think you've got it nailed, you visit a friend with a Mac running IE 5.2 ;)

The web just isn't print, and aiming for print-like control will really gobble up your development time. I've found that the more I move beyond a print mind set and learn how to generate flexible pages, the happier I am in my work.

CalArch90

1:42 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



O.k., thanks tedster. I think I'll take your advice and stop obsessing over things lining up perfectly and focus on content ;)