textarea wrap tests

Comparison of CSS and HTML4 wrapping in textarea tags

by mlhDevelopment

HTML

<textarea id="ta1" readonly="true" spellcheck="false">Test with white-space: nowrap
From: http://stackoverflow.com/a/657811/295686 and any CSS3 website
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
    at System.IO.StreamReader..ctor(String path)
    at LVKWinFormsSandbox.MainForm.button1_Click(Object sender, EventArgs e) in C:\Dev\VS.NET\Gatsoft\LVKWinFormsSandbox\MainForm.cs:line 36</textarea>

<textarea id="ta2" readonly="true" spellcheck="false" wrap="off">Test with wrap="off"
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
    at System.IO.StreamReader..ctor(String path)
    at LVKWinFormsSandbox.MainForm.button1_Click(Object sender, EventArgs e) in C:\Dev\VS.NET\Gatsoft\LVKWinFormsSandbox\MainForm.cs:line 36</textarea>

<textarea id="ta3" readonly="true" spellcheck="false" class="preferred">Test with white-space: pre; word-wrap: normal
From: http://stackoverflow.com/a/13446005/295686
    at...

CSS

textarea {
    font-family: verdana;
    font-size: 11px;
    width: 400px;
    height: 200px;
}
.preferred {
    border: solid 1px forestgreen;
    color: forestgreen;
}
#ta1 {
    white-space: nowrap; 
    overflow: auto;
}
#ta3 {
    white-space: pre; 
    word-wrap: normal;
    overflow: auto;
}
#ta4 {
    white-space: pre; 
    overflow: auto;
}