Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Word Wrap Text In Div.

Recommended Posts

how wrap the text content inside the div tag?

Word Wrap Text In Div.

 

Sir

I developed a site for company.The contents are displayed dynamically. With the help of Ajax.Here the contet are from Databse and placed inside "div tag".

Which are inside the "table". The content stored in the DB is in html format.

So the problem is SOME TIMES IF THE CONTENT'S(table ) WIDTH IS GREATER THAN THE SPECIFIED SIZE OF THE table(USER SIDE) THEN THE ALIGNMENT FULLY CHANGED.

 

THE CONTENT FROM THE DTATABASE COULD NOT OCCUPY THE SPECIFIED SPACE IN DISPLAY SIDE(user side). THE CONTENT COULD NOT WRAP and CANT PACED INSIDE THE TABLE.

Please help me how to wrap the content inside the table.

 

<td width="600" height="400px" bgcolor="#FFFFFF" colspan="2" >

<div id="txtHint" style="width:595; vertical-align:top ;" >

//CONTENT FROM DB

//AJAX TECHNOLOGY USED, the content paced in <div>

</div></td>

 

Plese help me

Saami

Share this post


Link to post
Share on other sites

text should be fixed inside div

Word Wrap Text In Div.

 

I need the text to be fit inside the div.Ie if I'm giving a long text the div should not expand and the words should fit inside and when I'm taking the mouse over the full text should be visible

 

-reply by ruby

Share this post


Link to post
Share on other sites
I solved it this way using divsWord Wrap Text In Div.

Hi, I had the same problem. I used php wordwrap() fucntion to plain text which worked just fine. But only until I had to convert my plain text fields to html fields. So, what I did was eliminated all fancy php functions and wrap my test displaying area on my page with a <div style="width:400px; white-space:normal"> [text  display area]</div>. Thats it. It worked just fine.

-reply by Sanjaya

Share this post


Link to post
Share on other sites

white-space:normal; WORKED! I had the same issue in Firefox 3.5.6, where text would not wrap inside a <div> tag. I even had "overflow: auto;" set. That only worked in IE7. <div style='white-space: normal;'> did the trick. Thanks a bunch!

Share this post


Link to post
Share on other sites
This is a no-brainer, hereWord Wrap Text In Div.

Hell yeah, that is a big one.

See, when a word is too long, like bbbbbbbbbbbbbbbbbbbb.. (and on and on) it WILL get ugly and stretch to the right.

But here's the solution:

just put { word-wrap: break-word } in your CSS! and it works ok.

-reply by Constantine

 

Share this post


Link to post
Share on other sites

i have table rows dynamically added..the text in the table cell comes from a xml file and due to the length of the text (its a URL) it stretches the width of the cell and spoils the display. I tried defining the cell style in css with the white-space:normal as previously said by someone. But it does not work here Can anyone help?

Share this post


Link to post
Share on other sites

white-space: pre; /* CSS 2.0 */white-space: pre-wrap; /* CSS 2.1 */white-space: pre-line; /* CSS 3.0 */white-space: -pre-wrap; /* Opera 4-6 */white-space: -o-pre-wrap; /* Opera 7 */white-space: -moz-pre-wrap; /* Mozilla */white-space: -hp-pre-wrap; /* HP Printers */word-wrap: break-word; /* IE 5+ */

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.