Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Enforcing table cell width

Reply
Thread Tools

Enforcing table cell width

 
 
laredotornado@zipmail.com
Guest
Posts: n/a
 
      03-06-2007
Hi,

What is a cross-browser way to enforce that a table cell adhere to a
specified width even if there's a word in there that exceeds that
width? Right now, the longer word is taking precedence over the table
width on both FF and IE.

Thanks, - Dave

 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      03-06-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> What is a cross-browser way to enforce that a table cell adhere to a
> specified width even if there's a word in there that exceeds that
> width? Right now, the longer word is taking precedence over the table
> width on both FF and IE.


I think the only way is to set the table cell to overflow:hidden or
overflow:scroll. Not tested.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/

Now playing: The Ramones - Surfin' bird
 
Reply With Quote
 
 
 
 
Jemdam.com
Guest
Posts: n/a
 
      03-06-2007
>
>> What is a cross-browser way to enforce that a table cell adhere to a
>> specified width even if there's a word in there that exceeds that
>> width? Right now, the longer word is taking precedence over the table
>> width on both FF and IE.

>
> I think the only way is to set the table cell to overflow:hidden or
> overflow:scroll. Not tested.
>

CSS is the only way to do this, there is no HTML table option for this. I
use tables far to much but I do think they are easy and quick to set up.

Cheers D http://www.binaryincome.com


 
Reply With Quote
 
laredotornado@zipmail.com
Guest
Posts: n/a
 
      03-06-2007
On Mar 6, 1:47 pm, "Jemdam.com" <(E-Mail Removed)> wrote:
> >> What is a cross-browser way to enforce that a table cell adhere to a
> >> specified width even if there's a word in there that exceeds that
> >> width? Right now, the longer word is taking precedence over the table
> >> width on both FF and IE.

>
> > I think the only way is to set the table cell to overflow:hidden or
> > overflow:scroll. Not tested.

>
> CSS is the only way to do this, there is no HTML table option for this. I
> use tables far to much but I do think they are easy and quick to set up.
>
> Cheers Dhttp://www.binaryincome.com


And what is the CSS way to do it? - Dave

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-06-2007
Scripsit (E-Mail Removed):

> What is a cross-browser way to enforce that a table cell adhere to a
> specified width


None. How wide is a table in speech rendering?

But if you are referring to reasonably new graphic browsers, then the answer
is, with the usual CSS Caveats, that you can "enforce" a width for a cell by
using table-layout: fixed for the table and by setting a width for the
entire table. (On IE, things work even if you don't set the table width; IE
defaults it to 100%.)

> even if there's a word in there that exceeds that
> width?


And what do you want to happen to the poor word? By default, the word
overflows to the neighbor cell, though IE uses the default of overflow:
hidden, i.e. brutally truncates the word. Both ways are rather problematic.

The answer to your _real_ question is _probably_ "Yes, people _can_ pollute
your guestbook with all kinds of stuff unless you take precautions. You
should preprocess the data so that the problem does not arise, e.g. by
truncating too long words before they get written onto a web page."

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Jim Moe
Guest
Posts: n/a
 
      03-06-2007
(E-Mail Removed) wrote:
>
> What is a cross-browser way to enforce that a table cell adhere to a
> specified width even if there's a word in there that exceeds that
> width? Right now, the longer word is taking precedence over the table
> width on both FF and IE.
>

Use a <div> inside the table cell. Set the div's width to the desired size.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
Jim Moe
Guest
Posts: n/a
 
      03-06-2007
(E-Mail Removed) wrote:
>
> What is a cross-browser way to enforce that a table cell adhere to a
> specified width even if there's a word in there that exceeds that
> width? Right now, the longer word is taking precedence over the table
> width on both FF and IE.
>

Hmm. On further consideration... What is the application (URL)? Maybe a
table is an inappropriate choice.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
laredotornado@zipmail.com
Guest
Posts: n/a
 
      03-06-2007
On Mar 6, 2:56 pm, "Jukka K. Korpela" <(E-Mail Removed)> wrote:
> Scripsit (E-Mail Removed):
>
> > What is a cross-browser way to enforce that a table cell adhere to a
> > specified width

>
> None. How wide is a table in speech rendering?
>
> But if you are referring to reasonably new graphic browsers, then the answer
> is, with the usual CSS Caveats, that you can "enforce" a width for a cell by
> using table-layout: fixed for the table and by setting a width for the
> entire table. (On IE, things work even if you don't set the table width; IE
> defaults it to 100%.)
>
> > even if there's a word in there that exceeds that
> > width?

>
> And what do you want to happen to the poor word? By default, the word
> overflows to the neighbor cell, though IE uses the default of overflow:
> hidden, i.e. brutally truncates the word. Both ways are rather problematic.
>
> The answer to your _real_ question is _probably_ "Yes, people _can_ pollute
> your guestbook with all kinds of stuff unless you take precautions. You
> should preprocess the data so that the problem does not arise, e.g. by
> truncating too long words before they get written onto a web page."
>
> --
> Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/


I want the word to be broken in mid-stream so that part appears on one
line and the rest appears on the next. I've tried setting a fixed
width for the entire table but the word (which is really a long email
address) is still breaking the table.

Thanks, - Dave

 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      03-06-2007
In article <(E-Mail Removed) m>,
"(E-Mail Removed)" <(E-Mail Removed)> wrote:

> I've tried setting a fixed
> width for the entire table but the word (which is really a long email
> address) is still breaking the table.


Before trying to accommodate a really long address in this
fashion, think of not putting in the address at all, just the
mailto: code with a descriptive short text to appear, like "Tex
Ritter's email" (which by the way will wrap fine naturally).

--
dorayme
 
Reply With Quote
 
Ben C
Guest
Posts: n/a
 
      03-06-2007
On 2007-03-06, (E-Mail Removed) <(E-Mail Removed)> wrote:
[...]
> I want the word to be broken in mid-stream so that part appears on one
> line and the rest appears on the next.


Not possible in CSS 2.1. Lines will only ever be broken in the proper
places. You can insert zero-width breaking spaces between each letter if
you really want to.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
picture width decides table column width David Basford HTML 3 09-30-2007 10:49 PM
Cell width error when containing variable width content mj.redfox.mj@gmail.com HTML 0 01-26-2006 03:37 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
Table width and columns width kris HTML 11 11-18-2003 06:49 AM
Re: resized image in table extends table width to original image width Sean Jorden HTML 1 08-19-2003 08:59 AM



Advertisments