473,461 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 266518
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.