Format text inside INPUT

Hello experts,

I have a problem with text formatting inside input tag.
I'm trying to take line down inside input field and it's not working, please help.

When i'm typing text that width bigger that 400px it not going one line down.
Each time that i'm pressing enter inside input my form submitted.

Please assist.
                <input style="width: 400px; height: 100px;" type="text" name="Problem" />

Open in new window

Who is Participating?
abelConnect With a Mentor Commented:
So, altogether that becomes:

<textarea style="width: 400px; height: 100px;" name="Problem" id ="Problem"></textarea>
I think what you are after is the <textarea></textarea> element, which should be used for multiline text boxes instead.
Ali KayahanFull Stack DeveloperCommented:
you should use ;
<textarea cols = '10' rows = '5' name = 'nomoreproblem'></textarea>
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

@ali: the cols/rows are deprecated in favor of CSS width/height.
DanSmirAuthor Commented:
Ali KayahanFull Stack DeveloperCommented:
@abel : thanks for your notice but not deprecated , w3's definition for it ;
"The size of a textarea can be specified by the cols and rows attributes, or even better; through CSS' height and width properties"
Indeed, you are right, apologies. And if you check the xhmtl1-strict DTD, it even says it is required, which means you actually have to use them. For finer control, however, I would always recommend using width/height as well.

<!ATTLIST textarea
  name        CDATA          #IMPLIED
  rows        %Number;       #REQUIRED
  cols        %Number;       #REQUIRED
  disabled    (disabled)     #IMPLIED
  readonly    (readonly)     #IMPLIED
  onselect    %Script;       #IMPLIED
  onchange    %Script;       #IMPLIED

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.