473,657 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Word wrap - textarea inside div

Hello, I am have a div and inside of that div I have a textarea. There
is nothing else in the div. The text in the textarea will come from a
database so it needs to be able to wrap and grow as necessary. I've
tried a whole bunch of permutations and I'm not having any luck. Any
help would be greatly appreciated. Here's the code:

HTML:

<div class='desc'><t extarea class='desc_tex t'>blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
</textarea></div>

CSS:

..desc
{
height: auto;
min-height: 14px;
background: #FFFFFF;
border: 0px solid #000000;
border-left-width: 1px;
font: 11px tahoma;
padding: 2px 2px 2px 2px;
margin: 0px;
float: left;
overflow: auto;
width: 225px;
text-align: left;
}

..desc_text
{
width: 220px;
text-align: left;
margin: 0px;
padding: 0px;
height: 13px;
font: 11px tahoma;
border: 0px;
}

Thank You.

Jun 19 '06 #1
2 19268
ma**********@gm ail.com <ma**********@g mail.com> scripsit:
The text in the textarea will come
from a database so it needs to be able to wrap and grow as necessary.
Is the text a useful _default value_ for an input field? If not, it should
not appear as textarea content. You might need to reconsider the idea, and
the technical side could become completely different, since textarea
elements are rather idiosyncratic, in implementations .

By HTML definition, textarea content _should not_ auto-wrap but it should
appear exactly as written. Are you sure you should _rely_ on CSS for
defeating this by-design feature? (Browsers are known to auto-wrap by
default, but you can rather reliably defeat this misfeature by using the
nonstandard attribute wrap="off".)
I've tried a whole bunch of permutations and I'm not having any luck.
Any help would be greatly appreciated. Here's the code:
You are not explaining what you wish to accomplish - and why. If the
textarea content is a meaningful default value, why shouldn't it be rendered
as written, especially considering the fact that line breaks may matter?
width: 220px; - - font: 11px tahoma;
border: 0px;


Wrong approach. User input, if anything, should adapt to the user-selected
font size. Hence, setting a width in pixels is wrong, too.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 19 '06 #2

Jukka K. Korpela wrote:
ma**********@gm ail.com <ma**********@g mail.com> scripsit:
The text in the textarea will come
from a database so it needs to be able to wrap and grow as necessary.


Is the text a useful _default value_ for an input field? If not, it should
not appear as textarea content. You might need to reconsider the idea, and
the technical side could become completely different, since textarea
elements are rather idiosyncratic, in implementations .

By HTML definition, textarea content _should not_ auto-wrap but it should
appear exactly as written. Are you sure you should _rely_ on CSS for
defeating this by-design feature? (Browsers are known to auto-wrap by
default, but you can rather reliably defeat this misfeature by using the
nonstandard attribute wrap="off".)
I've tried a whole bunch of permutations and I'm not having any luck.
Any help would be greatly appreciated. Here's the code:


You are not explaining what you wish to accomplish - and why. If the
textarea content is a meaningful default value, why shouldn't it be rendered
as written, especially considering the fact that line breaks may matter?
width: 220px;

- -
font: 11px tahoma;
border: 0px;


Wrong approach. User input, if anything, should adapt to the user-selected
font size. Hence, setting a width in pixels is wrong, too.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jukka - thank you very much for your reply. I obviously wasn't
thinking about my problem in the right way and you have set me
straight! I'm scraping the textarea altogether.

Jun 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
21102
by: Toronto Web Designer | last post by:
<textarea name="application" cols="50" rows="12" wrap="virtual" class="textarea"></textarea> Apparently "wrap" is deprecated or not allowed for html 4.01, any suggestions on what I should use instead?
5
28077
by: Toronto Web Designer | last post by:
<textarea name="application" cols="50" rows="12" wrap="virtual" class="textarea"></textarea> Is there a way to include the wrap in CSS or is that a structure thing?
3
6755
by: Fluffy Convict | last post by:
I am trying to write a script that changes a textarea wrap realtime, basically like you can switch to and from "wordwrap" in Microsofts Notepad. Because of a bug (https://bugzilla.mozilla.org/show_bug.cgi?id=302710), FireFox does not listen to the textarea.wrap = 'soft' command. Because I want the script to be cross-browser compatible, someone suggested to remove and immediately add a node to the DOM, so I now have: ...
8
52998
by: Mark D. Smith | last post by:
Hi I have googled but not found a solution to wordwrap in a textarea using firefox/netscape. is there a style sheet solution or am i stuck with not being able to force wrapping in a textarea Mark
9
9638
by: Joel Byrd | last post by:
I've got a div whose width is specified as a percentage so that if you shrink the browser window, the div shrinks, and the text inside the div wraps around to accommadate this. The problem is: if I put a really long word (like a web address) in the div, then it props the rest of the text open to the width of the word, and the text can't wrap past that width; but if I shrink the browser window, the div also shrinks and so the net result...
10
72686
by: Lorenzo Thurman | last post by:
I have a table cell that I want to wrap text inside of. I've tried both hard and soft wrap, but Firefox refuses to obey. IE 6&7 handle the wrap just fine. Does anyone know how I can fix this?
8
6938
by: gazza67 | last post by:
Hi, I want to do something that I thought would be simple but i cant seem to work it out, perhaps someone out there could help me. I want to browse for a file (it will be a word document), save the file name to a string and then at some later stage open that file with word. The operating system will be windows 2000 (dont know if that makes a difference or not).
6
4621
by: Eric Layman | last post by:
Hi, I have fields from textareas. With a click of a button, php is able to grab these fields and by using header(), convert the output to Ms Word doc. But the outcome of the word doc doesn't wrap the text in textarea. the result is one very veyr long string of text which stretch MS word all
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.