View Full Version : Setting Max width of a text area
12-14-2006, 10:17 AM
This is probably an easy to answer question, but I am at a loss here.
I have a text area on my site for people to submit comments, and well, it seems some people are entering LOOOONNNNGGG words. Now when they enter these long words, they mess up the alignment on my page when displayed from my database.
Is there a way to limit the amount of horizontal characters in a text area??
Thanks a lot!
12-14-2006, 02:15 PM
Using just html/css, no, I don't think so. Well, not without cutting off text, anyway. I assume you want a wrapping behavior.
Using any variety of scripting solutions, yes. You'd have to have some set character count and insert a space or other recognized word delimiter in there if one didn't exist.
It sounds like the problem is users entering characters in a row, all smushed up, right? No spaces or anything. So, you'd have to make a space either before the data is entered into the DB to begin with, or upon retrieval.
At least, as far as I know.
12-14-2006, 03:50 PM
I don't know of any way of making CSS wrap either, but adding overflow: hidden to the CSS of your text area will at least stop it from breaking when someone puts a long word in it, till you figure out how to wrap it.
12-14-2006, 07:58 PM
Also, this might have a different answer if the element is a real textarea, like for a form, as opposed to like a div or span.
I think a textarea form element would wrap regardless, with no issues.
12-15-2006, 05:04 AM
<!--I am not sure of this, so just recheck.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.