May 12, 2008

Word Wrap Text In Div.

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..
Pages: 1, 2

free web hosting

Word Wrap Text In Div.

kvarnerexpress
i use 2 div's for the page layout. One for navigation and one for the contents.

html Code:

Original - html Code:

CODE
   <div width="10%" style="position: absolute; left: 2%;"> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb </div> <div width="86%" style="position: absolute; left: 14%;"> bbbb </div>


But now the b's wont stay within their div-element. I want lines that doesnt fit on one line within the divto wrap to the next line.

How can i do this?
Thanks,kvarnerexpress


Reply

Saint_Michael
CODE

<div style="position:absolute; top:20; left:20; width:300; height:300;></div>[/div]


you have to use the top in your div position in order to seperate it work with this set up and you will solve your issue.


Notice from dundun2007:
Edited as requested

Reply

Lozbo
I didnt actually understand what you were asking, but i think i can see what your trouble is, as you put so many 'b's together, the div is expanding itself to fit its content, but it would be different with normal words (words with less than 10 characters or whatever).

So i think that what st mike said wont do, i dont know if theres anyway to css that, like "white-space: nowrap", but upside down this property, becouse what i understood is that you want the text to actually WRAP.

Reply

Saint_Michael
no kvan is asking how to septerate the 2 tables if you notice the b's that are group together that look like doubles, thats what he is referring to.

Reply

snlildude87
No, Michael. Lozbo is right. I've had this trouble when coding templates. If you use a really long word, then I suggest just using the wordwrap function in PHP to break it down. Like Lozbo said, if you're typing normally, then your word should wrap, and you will be fine. Long words are what usually break layout anyway, and there is really no way to fix this (I may be wrong, so you CSS gurus correct me if I am).

Reply

Saint_Michael
ok then if that is the case then all you would have to do is sperate the text using a <br> or <p> tag then, cuz i just now tried different settings with width and height and i got nothing.

but with css that geared more towards tables then <div> tags, but if you put the <div> tag within the table then it should word wrap with in the table its self.

Reply

Tyssen
QUOTE(Saint_Michael @ Sep 14 2005, 12:11 PM)
but with css that geared more towards tables then <div> tags, but if you put the <div> tag within the table then it should word wrap with in the table its self.

CSS geared towards tables? Where'd you get that from? blink.gif
And if you're using CSS, why would you enclose your div within a table?
Even if you were using tables, if a word is too long, like snlildude87 says, it's gonna stretch the width of the table cell regardless of whether you've set a width or not.

Reply

Lozbo
QUOTE(snlildude87 @ Sep 13 2005, 07:35 PM)
If you use a really long word, then I suggest just using the wordwrap function in PHP to break it down.
*


How's that wordwrap function from php?

So i have also been trying to hack that out but didnot know how to do it.

Michael i think that <br /> or <p> wont do what kvar seeks, becouse that would make the layout always break, not when the browser resizes.

Reply

littleweseth
If you don't mind using a scrollbar, you can apply the following style :
CODE

#longlines {
clip : auto;
overflow : scroll;
}


Anything that doesn't fit will automagically make it's parent box scrollable. Of course, if this is your content box, this will be a sonna sam for your users (scroll to bottom of page, move across, move back up, go back down, go across....), but if you're only enclosing small samples it should be fine.

Reply

Lozbo
hey little weseth, about this issue of making its parent box scrollable, i havent been able to make a td scrollable, i think i heard it was not possible, is it? only thing i can figure out to get pass this is by adding a div inside the cell, but i dont know if theres anyother way...

Reply

Latest Entries

Trap FeedBacker
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

Reply

Trap FeedBacker
Use overflow
Word Wrap Text In Div.

Replying to Tyssen

There is a style attribute 'overflow' which you can use to accomplish this. There are 3 values of this attribute viz. Auto, scroll and hidden. If you want only scroll to be present horizontally, you can use overflow-x, or overflow-y as per your case. Read this for further information (http://msdn2.Microsoft.Com/en-us/library/ms534312(VS.85).Aspx)

-reply by Gaurav

Reply

Trap FeedBacker
Try using <span></span> around your text

-FooSoup

Reply

Tyssen
QUOTE(Re_Atum @ Oct 4 2005, 09:36 AM)
CODE
  <div width="10%" style="position: absolute; left: 2%; word-wrap:break-word;"> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb </div> <div width="86%" style="position: absolute; left: 14%;word-wrap:break-word;"> bbbb </div>


That only works in IE/WIN and Safari 1.3+.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. css text wrap inside tables - 0.19 hr back.
  2. div text wrap - 0.57 hr back.
  3. div style word wraping - 0.65 hr back.
  4. text wrap in div - 0.91 hr back.
  5. wrap text in a table in word - 1.66 hr back.
  6. div wrap text - 1.99 hr back.
  7. how can we wrap a text in div - 3.18 hr back.
Similar Topics

Keywords : word, wrap, text, div

  1. Centered Div Layout Issues
    Float Right item not vertically aligned with text (2)
  2. Text Problem
    (6)
    Alright well I am having a slight problem with my coding. I made my template and have it up on my
    site but my text I placed in the content box is towards the middle. I would like it at the top but
    I forget how to do that. I know it has to do with some like putting a table inside the table and
    making the height 100% or something. If someone could help me out with the coding I would greatly
    appreciate it. The link to my site is Here and the code used for the content box is this...
    CODE   <td colspan="6" rowspan="3"background="images/cont....
  3. Select All Text In A Form Field On Click
    (1)
    Hi, I have made a script which generates a BBcode when you run it, and displays it in a text field,
    like this: CODE <input type="text" name="bbcode" size="81"
    value="[IMG]<?php echo $url; ?>[/IMG]"> Well, anyway, I
    want something that selects all the text in that form field when you click on it, like it does in
    ImageShack when you upload.......
  4. Glow Text
    need help (2)
    Hi i Have One Vbulletin Form and i want Glow Users Name in form How can i do this I search in
    JavaScripts but i can not find it If You find it tell me thanks then Where Past this code on my form
    thanks /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' /> ....
  5. Add Text In Input-field
    (5)
    this is a picture of my shoutbox: one problem: the links/code for adding one of the smilies to
    the message-input-field (text: e.g. /laugh.gif' border='0' style='vertical-align:middle'
    alt='laugh.gif' /> , /unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' />
    ,...) are missing. Does someone knows how this can be fixed? -the name of the message-input-field
    is "message". thanks in advance! /cool.gif' border='0' style='vertical-align:middle'
    alt='cool.gif' /> ....
  6. Layers With Text Appear
    (1)
    When I view this page in a Firefox browser on a Windows operating system, it looks fine, but when I
    view it on a friend's Firefox browser on his Linux operating system, the text layers extend
    their height downward on the page and overlaps the graphics on the bottom of the page. Is there a
    known fix?....

    1. Looking for word, wrap, text, div

Searching Video's for word, wrap, text, div
advertisement



Word Wrap Text In Div.



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE