size of cell wrong if data long

T

tshad

I am having problems with cells that have long data with no spaces to break
on and was curious as to how others solve this problem.

I have the following file that I took from my view source of my page.

I have a table that has 5 cells of defined lengths
(50px,50px,50px,50px,200px)

Normally, the table is correct and displays fine. If the data is too long
it wraps to the next line, which is fine.

The problem is when I am using an email where there are no spaces in the
text for the program to break on.

This causes the table to increase the size of the Email cell and all the
other cells are decreased proportionally.

I can substring the data to smaller length but then you lose part of the
email if a person happens to have a very long email name.

Here is an example of the file and table:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>:: Stw1::</title>
</head>
<body id="myBody">
<br><br>
<table cellspacing="0" cellpadding="1" rules="all" border="1" id="_ctl1"
style="color:Black;background-color:Beige;width:600px;border-collapse:collapse;">
<tr style="background-color:Brown;">
<td style="width:100px;">UserID</td>
<td style="width:100px;">FirstName</td>
<td style="width:100px;">LastName</td>
<td style="width:100px;">Title</td>
<td style="width:200px;">Email</td>
</tr>
<tr>
<td style="width:100px;">152</td>
<td style="width:100px;">Tom</td>
<td style="width:100px;">Lawrence</td>
<td style="width:100px;">CTO1</td>
<td style="width:200px;">[email protected]</td>
</tr>
<tr style="background-color:Gainsboro;">
<td style="width:100px;">154</td>
<td style="width:100px;">Brandon</td>
<td style="width:100px;">Franklin</td>
<td style="width:100px;">Owner</td>
<td
style="width:200px;">[email protected]</td>
</tr>
</table>
</body>
</html>

As you can see the last <td> is the problem. This normally doesn't happen,
but every once and a while it does and messes up the table.

Thanks,

Tom
 
J

Jukka K. Korpela

Scripsit tshad:
I am having problems with cells that have long data with no spaces to
break on

Such issues have been discussed fairly often in this and other newsgroups.
Check past discussions via Google Groups or otherwise.
I have a table that has 5 cells of defined lengths
(50px,50px,50px,50px,200px)

Stop setting fixed widths. Remove all width attributes from HTML and width
property settings in CSS. Consider adding some percentage or em settings
then, _if needed_.
The problem is when I am using an email where there are no spaces in
the text for the program to break on.

An email address isn't that long, so if you remove the fixed widths, you
solve the problem (or, rather, stop creating it). An email address should
seldom be broken across lines anyway. If you feel you ever need to do that,
reconsider the design decisions that led to such a situation.
Here is an example of the file and table:

In future, post a URL, not bulks of code. Hang around and you'll see reasons
to this.
 
T

Travis Newbury

I am having problems...
<snip>

This is one of the issues you have to deal with when you go with a
fixed width design. You have basically 3 choices:

1. Do what Yucca said and abandon the fixed width site.

2. Widen the fixed width to accommodate a wider email column (are you
sure you can you predict what the widest will be?)

3. Leave it alone and don't worry about the exception.
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Wed, 29 Aug 2007 18:49:29
GMT tshad scribed:
I am having problems with cells that have long data with no spaces to
break on and was curious as to how others solve this problem.

I have the following file that I took from my view source of my page.

I have a table that has 5 cells of defined lengths
(50px,50px,50px,50px,200px)

Normally, the table is correct and displays fine. If the data is too
long it wraps to the next line, which is fine.

The problem is when I am using an email where there are no spaces in
the text for the program to break on.

This causes the table to increase the size of the Email cell and all
the other cells are decreased proportionally.

I can substring the data to smaller length but then you lose part of
the email if a person happens to have a very long email name.

Here is an example of the file and table:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>:: Stw1::</title>
</head>
<body id="myBody">
<br><br>
<table cellspacing="0" cellpadding="1" rules="all" border="1"
id="_ctl1"
style="color:Black;background-color:Beige;width:600px;border-collaps
e:collapse;">
<tr style="background-color:Brown;">
<td style="width:100px;">UserID</td>
<td style="width:100px;">FirstName</td>
<td style="width:100px;">LastName</td>
<td style="width:100px;">Title</td>
<td style="width:200px;">Email</td>
</tr>
<tr>
<td style="width:100px;">152</td>
<td style="width:100px;">Tom</td>
<td style="width:100px;">Lawrence</td>
<td style="width:100px;">CTO1</td>
<td style="width:200px;">[email protected]</td>
</tr>
<tr style="background-color:Gainsboro;">
<td style="width:100px;">154</td>
<td style="width:100px;">Brandon</td>
<td style="width:100px;">Franklin</td>
<td style="width:100px;">Owner</td>
<td
style="width:200px;">[email protected]<
/td>
</tr>
</table>
</body>
</html>

As you can see the last <td> is the problem. This normally doesn't
happen, but every once and a while it does and messes up the table.

Put the email address in a div with the same width as the cell (200px)
and set overflow:auto; on the div. 'Course then you'll get a horizontal
scrollbar, but, hey, this isn't Elysium.

What's background-color:Gainsboro;?
 
T

tshad

Neredbojias said:
Well bust mah britches and call me cheeky, on Wed, 29 Aug 2007 18:49:29
GMT tshad scribed:


Put the email address in a div with the same width as the cell (200px)
and set overflow:auto; on the div. 'Course then you'll get a horizontal
scrollbar, but, hey, this isn't Elysium.

What's background-color:Gainsboro;?

Don't know.

It was on the test file I was using.

Thanks,

Tom
 
B

Blinky the Shark

Jonathan said:
I'm partial to "background-color: Constable;"

Okay, I can get a color out of "Gainsboro" (blue, as in "Blue Boy"), but
what color do you imply with Constable?
 
J

Jonathan N. Little

Blinky said:
Okay, I can get a color out of "Gainsboro" (blue, as in "Blue Boy"), but
what color do you imply with Constable?

Oh, maybe a deep green. Old British painters theme...
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Fri, 31 Aug 2007 01:23:46 GMT
Blinky the Shark scribed:
Okay, I can get a color out of "Gainsboro" (blue, as in "Blue Boy"), but
what color do you imply with Constable?

Aluminium, of course. (Cons + Table)
 
B

Blinky the Shark

Neredbojias said:
Well bust mah britches and call me cheeky, on Fri, 31 Aug 2007 01:23:46 GMT
Blinky the Shark scribed:


Aluminium, of course. (Cons + Table)

Huh?
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Fri, 31 Aug 2007 05:27:56
GMT Blinky the Shark scribed:

Convicts => prison inmates. Their lunch/dinner tables...

Oh, all right, it was a stretch.
 
B

Ben C

Well bust mah britches and call me cheeky, on Fri, 31 Aug 2007 05:27:56
GMT Blinky the Shark scribed:


Convicts => prison inmates. Their lunch/dinner tables...

Oh, all right, it was a stretch.

Not a bad crossword clue.
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top