954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Controlling the max text length

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?

adaykin
Junior Poster in Training
73 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

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

gpm1982
Newbie Poster
6 posts since Feb 2008
Reputation Points: 12
Solved Threads: 1
 

thx that got it working for me!

adaykin
Junior Poster in Training
73 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

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

macneato
Posting Pro in Training
421 posts since Jun 2007
Reputation Points: 46
Solved Threads: 48
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You