Forum Moderators: open

Message Too Old, No Replies

textarea wrap in XHTML?

What is the alternative in XHTML?

         

craig1972

9:29 am on Apr 21, 2003 (gmt 0)

10+ Year Member



Hi, textarea used to have a really useful property of "Wrap=off". How do I achieve this in XHTML 1.1?

Thanks for any ideas, the site search did not reveal any result!

ShawnR

9:42 am on Apr 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In html the textarea tag has never had a wrap attribute. Netscape and IE both supported a proprietary wrap attribute but the values allowed were different (IE: off¦physical¦virtual, NN: off¦hard¦soft).

I think the best way to do it is with CSS. For example, you may be able to achieve the result you want with the white-space property. Possible Values are: normal¦pre¦nowrap

i.e.
white-space: nowrap;

Shawn

craig1972

10:13 am on Apr 21, 2003 (gmt 0)

10+ Year Member



thanks shawn. didnt know about "white-space" at all!

however, "white-space: nowrap" works in Opera, but does not work in mozilla (wraps anyway) or IE (becomes only one line).

is there any solution to this, or should i leave it without white space?

ShawnR

10:50 am on Apr 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Craig

Hmm... Even though IE doesn't do what you want, it seems it is within the spec (doesn't do a line break on any white space), even though this is not too sensible in the context of a form the user is filling in.

I'm afraid I don't know the answer. Perhaps a CSS guru might be able to help, so perhaps ask on the CSS forum.

Of course, if you don't find a solution, (putting on flame proof jacket now...) you could choose to just use the wrap attribute you used to use. It is not valid XHTML, but it never stopped you before and it was never valid HTML. (I'll probably get my WebmasterWorld membership revoked for that ;) )

Shawn