473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How To Wrap Text With CSS

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <table width="777" border="0" cellspacing="0" cellpadding="0">
  10.   <tr>
  11.     <td>gdgdgdfgdf</td>
  12.     <td style="clear:right">gdfggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg</td>
  13.   </tr>
  14. </table>
  15. </body>
  16. </html>
  17.  
How can i able to arrange this text to wrap using css. Anyone help me pls
Apr 4 '07 #1
18 266494
AricC
1,892 Expert 1GB
Trying using word-wrap: break-word
Apr 4 '07 #2
drhowarddrfine
7,435 Expert 4TB
word-wrap? What's that?

You have to play with the width of table and the width of the rows and cells.
Apr 5 '07 #3
KevinADC
4,059 Expert 2GB
word-wrap

seems that only IE supports it, or it did when the above resource was written.
Apr 5 '07 #4
drhowarddrfine
7,435 Expert 4TB
Then it is worthless. Do not use it.
Apr 5 '07 #5
word-wrap

seems that only IE supports it, or it did when the above resource was written.

Thanks for the suggestion. It works with <div> and <p> but if i use inside table word is not wrapping.

Any suggestions pls
Apr 5 '07 #6
KevinADC
4,059 Expert 2GB
it seems to work if you define the properties in the TD cell:

<td style="word-wrap: break-word" width="100">
Apr 5 '07 #7
it seems to work if you define the properties in the TD cell:

<td style="word-wrap: break-word" width="100">
Thank you very much it works fine.
Apr 5 '07 #8
drhowarddrfine
7,435 Expert 4TB
Again, a reminder, that word-wrap does nothing for any other browser.
Apr 5 '07 #9
AricC
1,892 Expert 1GB
Again, a reminder, that word-wrap does nothing for any other browser.
Huh, I should have checked the compatible browsers sorry karthi.
Apr 5 '07 #10
ismailc
200 100+
it seems to work if you define the properties in the TD cell:

<td style="word-wrap: break-word" width="100">
Hi,

I am struggling with the same problem using Coldfusion 5 where I want to cut off the text and not allowing for text wrap in my column.

<td style="word-wrap: break-word" width="100" align="left">#test#<td>

I used the previous example but unfortunately it does not work.

Any help please!

Thank You
Apr 19 '07 #11
drhowarddrfine
7,435 Expert 4TB
Change everything in style to style="width:100px"
Apr 19 '07 #12
ismailc
200 100+
Change everything in style to style="width:100px"
Thank You it worked :-)
Apr 20 '07 #13
KevinADC
4,059 Expert 2GB
You don't want the text to wrap?

<td nowrap>text</td>

there might be a CSS equivalent to the nowrap attribute. Note that nowrap is a stand alone attribute, there is no "=value" part.
Apr 20 '07 #14
elgreg
3
You don't want the text to wrap?

<td nowrap>text</td>

there might be a CSS equivalent to the nowrap attribute. Note that nowrap is a stand alone attribute, there is no "=value" part.

According to w3.org "nowrap" is deprecated. You should be using <td style="white-space:nowrap;">Cell Contents</td> I've found this to work in both IE6 and FF 2.x without having to specify a column width.
Apr 23 '07 #15
navink
1
<td style="WORD-BREAK:BREAK-ALL;"> here is ur data </td>

let me know... :)
Feb 14 '09 #16
Dormilich
8,658 Expert Mod 8TB
if you have long words you can also use the soft hyphen (&#173; or &shy;).
Feb 14 '09 #17
drhowarddrfine
7,435 Expert 4TB
@navink
Wonderful. Another non-existent solution with a non-existent property to a 2-year old thread.

Actually, that property now exists in CSS3 but it's not supported by any browser.
Feb 14 '09 #18
Here is the generic solution that i found:

In CSS:

Expand|Select|Wrap|Line Numbers
  1. .wrapword{
  2.  white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
  3.  white-space: -pre-wrap;      /* Opera 4-6 */
  4.  white-space: -o-pre-wrap;    /* Opera 7 */
  5.  white-space: pre-wrap;       /* css-3 */
  6.  word-wrap: break-word;       /* Internet Explorer 5.5+ */
  7. }

Anywhere in HTML:
Expand|Select|Wrap|Line Numbers
  1. <td class="wrapword"> ... </td>
Dec 7 '10 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mark P | last post by:
My images are fixed in size and can't be redone. Many of them are tall and narrow. How can I wrap text so that the text starts on the right of the image at a level with the top of the image....
2
by: amber | last post by:
Hello, I have a datagrid column header that is quite long, and I would like it to appear on 2 lines instead of 1. Is this possible? TIA. Amber
1
by: Grant Hammond | last post by:
I assume I'm not alone in my frustration that the expression builder that comes (in part) with Access XP that dosnt wrap text when you open it on an exisitng expression in a query or form. I's...
0
by: Norman Fritag | last post by:
Hi there, 1) I is there a more elegant way, more professionally way this export could done, as I have written some code for the first time? 2) who could I wrap text cell a1 a3 via code ? 3) is...
4
by: searider86 | last post by:
Does anyone know if there is a snippet of code that automatically removes the wrap text format in excel? I have an access form that displays data and allows the user to click on a cmdbutton to...
1
by: Diego | last post by:
Hi, how do I set the wrap property to FALSE for a datagrid with autocolums enabled? I know there's a work around this bug when the columns are set up in design time but I need the autocolumns...
2
by: Rocco | last post by:
Hi, I have a drop down box with width=120px. The box length cannot be extended because of design issue. How can I wrap text in html drop down box ? Thanks, Rocco
0
by: Keithb | last post by:
I have a GridView control with 2 template columns. Both contail a Label control in their ItemTemplate. The right column label wraps text on long strings, the left column just gets wider with long...
15
by: removeps-groups | last post by:
How to wrap text in <ptag if the text has no spaces and is very long? Here is an example: ...
3
by: raamay | last post by:
I picked up the below code from some website and it is absolutely good working code except that the wrap text feature is not available. The value of field1 below do not go to a new line if the value...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.