User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 397,839 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,578 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 460 | Replies: 3 | Solved
Reply
Join Date: Feb 2007
Posts: 56
Reputation: adaykin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Controlling the max text length

  #1  
Jun 23rd, 2008
Hello, I am trying to control the max length that the text appears, before it goes to the next line in a div. So I want the div to be say 100, but I want the text to only reach 50 before it wraps to the next line. Is there a way I can do this?
My Website <-- check out my site!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Posts: 6
Reputation: gpm1982 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
gpm1982 gpm1982 is offline Offline
Newbie Poster

Re: Controlling the max text length

  #2  
Jun 24th, 2008
It's possible using JavaScript. Use the slice() function to do it. More on slice() function at
http://www.w3schools.com/jsref/jsref_slice_string.asp
Reply With Quote  
Join Date: Feb 2007
Posts: 56
Reputation: adaykin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Re: Controlling the max text length

  #3  
Jun 24th, 2008
thx that got it working for me!
My Website <-- check out my site!
Reply With Quote  
Join Date: Jun 2007
Posts: 178
Reputation: macneato is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 12
macneato's Avatar
macneato macneato is offline Offline
Junior Poster

Re: Controlling the max text length

  #4  
Jun 24th, 2008
Or you could just use padding (which can be added directly to your div id)

So if your div is 100px long and you would like it to start a new line at 50px you would add

padding-right:50px
If this reply solved your problem, please add to my reputation and don't forget to mark this thread as solved.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb HTML and CSS Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 7:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC