Hi,

Is there any way of using textarea in Firefox like we use in IE because, lines are not broken down into rows.

Thanks

Dani AI

Generated

It looks like you are seeing Firefox visually keep one long line instead of wrapping it, while IE wraps it. is right that rows and cols set the control’s size, but they do not control how text wraps. Use the wrap attribute to make the behavior consistent across browsers MDN textarea.

  • If you want text to wrap visually but not insert line breaks into the submitted value (common case), use wrap="soft":
<textarea rows="2" cols="20" wrap="soft"></textarea>
  • If you want the browser to insert hard line breaks at the wrapping points so the submitted value contains newlines, use wrap="hard":
<textarea rows="2" cols="20" wrap="hard"></textarea>

Note: rows controls the height (number of visible lines), and cols sets the wrapping width in characters; neither forces the content to be limited to that many lines. More details on wrap and how it affects submission are here MDN: wrap.

Troubleshooting tips for :

  • Make sure no CSS is preventing wrapping (for example, textarea { white-space: nowrap; } or forcing a horizontal scrollbar with overflow-x: scroll;).
  • If you are typing a single very long word with no spaces, browsers are allowed to keep it unbroken and show a horizontal scrollbar. There is no cross-browser, standards-based way to break unspaced text inside a textarea without altering the text itself.

Recommended Answers

All 2 Replies

What do you mean? rows/cols attributes work the same as far as I know

try to type something into this textarea in Firefox.

<textarea rows="2" cols="20"></textarea>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.