Strange Table Behaviour

S

Smiley

I've got this very basic table that I can't get to work properly in
Explorer. Firefox shows it properly, but for some reason Explorer doesn't.
Here's the table:


<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="170" height="160">&nbsp;</td>
<td rowspan=2 valign=top>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>


The top left hand corner cell is supposed to have a height of 160. In
Firefox, it does have a height of 160. In Explorer, the height is WAY off.
Is explorer just ignoring my height setting? What's going on here?

Please help.
 
S

Stan McCann

ie...

Actually, yes. Verry funny.

And very poor coding practices. <br> and &nbsp; should rarely be used.
And any time you have more than one together, something is wrong.
 
S

Smiley

Stan McCann said:
And very poor coding practices. <br> and &nbsp; should rarely be used.
And any time you have more than one together, something is wrong.

Why is that?
 
S

Stan McCann

Why is that?

If you have to ask, you're not going to care what I say anyway but
here goes.

<br> is often misused (as in the code I saw) to add vertical space.
That is a purely presentational thing when we have CSS for
presentational purposes. Use CSS instead.

&nbsp; is often misused (as in the code I saw) to add horizontal
space. That is a purely presentational thing when we have CSS for
presentational purposes. Use CSS instead.

The solution to the woes asked about are simple. Learn HTML and CSS.

It wasn't that long ago that I was creating pages that way too so I do
understand how and why people come up with code like that. I then
started really learning HTML and CSS. I don't edit pages in Netscape
Composter anymore.
 
S

Smiley

Stan McCann said:
If you have to ask, you're not going to care what I say anyway but
here goes.

<br> is often misused (as in the code I saw) to add vertical space.
That is a purely presentational thing when we have CSS for
presentational purposes. Use CSS instead.

&nbsp; is often misused (as in the code I saw) to add horizontal
space. That is a purely presentational thing when we have CSS for
presentational purposes. Use CSS instead.

The solution to the woes asked about are simple. Learn HTML and CSS.

It wasn't that long ago that I was creating pages that way too so I do
understand how and why people come up with code like that. I then
started really learning HTML and CSS. I don't edit pages in Netscape
Composter anymore.

--

The only thing you've really told me here is that you can use CSS as an
alternative. You haven't told me why it's not good to use <BR> or &nbsp; -
is there some sort of problem you can run into with those commands? Are you
saying the reason I'm having problems is because I used them? Please
explain further.
 
R

Richard Sexton

And very poor coding practices. said:
If you have to ask, you're not going to care what I say anyway but
here goes.

<br> is often misused (as in the code I saw) to add vertical space.
That is a purely presentational thing when we have CSS for
presentational purposes. Use CSS instead.

&nbsp; is often misused (as in the code I saw) to add horizontal
space. That is a purely presentational thing when we have CSS for
presentational purposes. Use CSS instead.

The solution to the woes asked about are simple. Learn HTML and CSS.

What if you don't want to use CSS?

I use BR and NBSP all the time. Sparks have as of yet to fly out the back of
my computer.

Insisting on using a style sheet where one &nbsp; will do strikes me as silly.

Is there some situation where it doesn't work?
 
S

Stan McCann

The only thing you've really told me here is that you can use CSS as
an alternative. You haven't told me why it's not good to use <BR>
or &nbsp; - is there some sort of problem you can run into with
those commands? Are you saying the reason I'm having problems is
because I used them? Please explain further.

A couple of starters:

http://www.w3.org/TR/html4/
http://gutfeldt.ch/matthias/articles/doctypeswitch.html

What you are doing is semantically incorrect. The modern thinking
(you're thinking 1995 methodolgy) is to separate content from layout.
HTML handles the content, and CSS handles the layout.

Imagine being a blind person listening to your page and hearing
something like "line break line break line break line break ..."
Most people I've talked to find it easier to maintain their documents
along with a consistent format for them.

There are plenty of free resources out there (this group is one if
you'll read here often) that can help you learn HTML. I've maintained
a web site largely authored by others using a 1996 layout and design
for a number of years. Yech, secretaries don't make very good web page
authors. Now, I'm in the process of a task that, if I had to do it
your way, would take years. By learning/using valid HTML (XHTML in
this case, against my advice) and CSS and how to do things in a
meaningful way, I expect months instead.
 
S

Smiley

Stan McCann said:
A couple of starters:

http://www.w3.org/TR/html4/
http://gutfeldt.ch/matthias/articles/doctypeswitch.html

What you are doing is semantically incorrect. The modern thinking
(you're thinking 1995 methodolgy) is to separate content from layout.
HTML handles the content, and CSS handles the layout.

Imagine being a blind person listening to your page and hearing
something like "line break line break line break line break ..."
Most people I've talked to find it easier to maintain their documents
along with a consistent format for them.

There are plenty of free resources out there (this group is one if
you'll read here often) that can help you learn HTML. I've maintained
a web site largely authored by others using a 1996 layout and design
for a number of years. Yech, secretaries don't make very good web page
authors. Now, I'm in the process of a task that, if I had to do it
your way, would take years. By learning/using valid HTML (XHTML in
this case, against my advice) and CSS and how to do things in a
meaningful way, I expect months instead.

This is all very interesting, but it doesn't help explain why I'm having
problems here. Do you have answer to that?
 
T

Tommy

Smiley said:
I've got this very basic table that I can't get to work properly in
Explorer. Firefox shows it properly, but for some reason Explorer doesn't.
Here's the table:


<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="170" height="160">&nbsp;</td>
<td rowspan=2 valign=top>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>


The top left hand corner cell is supposed to have a height of 160. In
Firefox, it does have a height of 160. In Explorer, the height is WAY off.
Is explorer just ignoring my height setting? What's going on here?

Please help.

Try that way.

<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="170" bgcolor="#C0C0C0"></td>
<td rowspan=2 valign=top bgcolor="#00FFFF">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
</td>
</tr>
<tr>
<td bgcolor="#FFFF00"></td>
</tr>
</table>

I put colours for easier display.
 
M

Mitja Trampus

Smiley said:
Stan McCann said:
[sound advice on accessibility, html+css]
This is all very interesting, but it doesn't help explain why I'm having
problems here. Do you have answer to that?

Pffft, the arrogance, doesn't know his nbsp's from his br's
and he'd like his question answered... ;)

The answer is, I'm afraid, rather obvious: no, he doesn't /
we don't know why IE does this. At least me - I've tried
applying height to tr instead of td, using non-quirks mode,
using table-layout:fixed - none worked.
So... tackle the problem differently. If you insist on a
table-based layout, go for nested tables <puke>.
Another alternative, as Uncle Pirate hinted, is to use DIVs
and CSS.

Try describing what layout you're trying to get, and perhaps
we can come up with a more elegant solution than these tables...
 
S

Smiley

Try that way.

<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="170" bgcolor="#C0C0C0"></td>
<td rowspan=2 valign=top bgcolor="#00FFFF">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
</td>
</tr>
<tr>
<td bgcolor="#FFFF00"></td>
</tr>
</table>

I put colours for easier display.

I don't think you understand what I'm trying to accomplish here. The top
left cell needs to have a height of 160, your code doesn't accomplish that
at all.
 
S

Smiley

Mitja Trampus said:
we don't know why IE does this. At least me - I've tried applying height
to tr instead of td, using non-quirks mode, using table-layout:fixed -
none worked.

So, it's a bug in IE then?
So... tackle the problem differently. If you insist on a table-based
layout, go for nested tables <puke>.
Another alternative, as Uncle Pirate hinted, is to use DIVs and CSS.

Try describing what layout you're trying to get, and perhaps we can come
up with a more elegant solution than these tables...

Okay, I wanted to put a background image in the top left cell that had a
height of 160. Unfortunately, in IE, the background image repeated itself
because it seemed to ignore the height property.

The bottom left cell would be blank, and the right side cell would contain
text. I used <BR>'s in my example because I didn't want to reproduce the
text I was going to use here and using a bunch of <BR>'s takes much less
room than quoting Lorem Ipsum.
 
J

Jonathan N. Little

Smiley said:
I also want to put writing overtop of the image in it's vertical center.

If it is just a specific bit of text, then put is in a DIV and absolute
position it exactly where you want.
 
J

Jim S.

i had a similar problem designing one of my forms, and i had a terrible time
until i dissected it , and found out that my answer is your answer too, ( to
some extend) : one browser is more forgiving than the other.
try this: it works
<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="170" height="160">&nbsp;</td>
<td rowspan=2 valign=top>&nbsp;

</td>
</tr>
<tr>
<td height="300">&nbsp;</td>
</tr>
</table>


i hope that helped u.

Jim.
 
S

Smiley

Jim S. said:
i had a similar problem designing one of my forms, and i had a terrible
time until i dissected it , and found out that my answer is your answer
too, ( to some extend) : one browser is more forgiving than the other.
try this: it works
<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="170" height="160">&nbsp;</td>
<td rowspan=2 valign=top>&nbsp;

</td>
</tr>
<tr>
<td height="300">&nbsp;</td>
</tr>
</table>


i hope that helped u.

There's a huge problem to your solution, Jim. It doesn't work. I want this
table to be able to accomodate any amount of text that I put into it. If
you try putting all the <BR>'s that I used to test it, your code falls
apart.

The reason is that you're code assumes that the bottom left cell will have a
height of 300. If the text goes beyond that, then both Explorer and Firefox
say "Screw it, this data is inconsistent - I'm just going to format the
height however I want"

I need the top left cell to have a height of 170 and the bottom left cell
should remain un-set so that it can stretch to accomodate my text.
 
A

Andy Dingley

Smiley said:
You haven't told me why it's not good to use <BR> or &nbsp; -
is there some sort of problem you can run into with those commands?

Just use the <br>s

You obviously don't care, we don't either. Have fun.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top