how to break a long word ?

M

mike hengins

Hi, I have a basic HTML question :
How do i set the properties of a table so that it breaks a long word like
"abcdefghijklmnopqrstuvwxyz"
(this long word is dynamically generated), and not expand the table to fit
the word ?
I tried many things, like width and height, they will not cut it.

Thanks for helping
 
M

Mark Parnell

Deciding to do something for the good of humanity, mike hengins
How do i set the properties of a table so that it breaks a long word like
"abcdefghijklmnopqrstuvwxyz"

You can't. A table cell will expand to fit the contents.
(this long word is dynamically generated),

Get your script to insert a hyphen, space or similar every n characters
when generating the string.
 
J

Jukka K. Korpela

mike hengins said:
Hi, I have a basic HTML question :

I don't think it's a basic HTML question; it's actually rather advanced. I
don't know whether this matters, but you may have some reason for writing
that you have a basic HTML question.
How do i set the properties of a table so that it breaks a long word
like "abcdefghijklmnopqrstuvwxyz"

You don't.
(this long word is dynamically generated),

So how could a poor lonesome browser know how it can be broken?

A word, or a "word", can be broken in (at least) two ways: just breaking it
at some point, so that a line break is just inserted somewhere, or as
hyphenation. Both are problematic. It's impossible to say which one you need
when you only gave a dummy example.

For the relevant technicalities in HTML, see
http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest
I tried many things, like width and height, they will not cut it.

They are not supposed to.

Setting table-layout: fixed in CSS "forces" specified widths, but this is
mostly part of the problem, not solution. You would need to consider
including spaces, or explicit line break opportunities, or even explicit
line breaks. The table cell content might still overflow. How would you plan
to handle it?
 
I

ironcorona

Mark said:
Deciding to do something for the good of humanity, mike hengins


You can't. A table cell will expand to fit the contents.

Unless you explicitly set your td width
 
E

Els

ironcorona said:
Unless you explicitly set your td width

Won't help. Unless you set overflow:hidden or scroll, which still
won't break the string into two lines.
 

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,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top