• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 408
  • Last Modified:

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.
<tr>
            <td>
                <input style="width: 400px; height: 100px;" type="text" name="Problem" />
           
            </td>

Open in new window

0
DanSmir
Asked:
DanSmir
  • 4
  • 2
1 Solution
 
abelCommented:
I think what you are after is the <textarea></textarea> element, which should be used for multiline text boxes instead.
0
 
abelCommented:
So, altogether that becomes:

<textarea style="width: 400px; height: 100px;" name="Problem" id ="Problem"></textarea>
0
 
Ali KayahanFull Stack DeveloperCommented:
you should use ;
<textarea cols = '10' rows = '5' name = 'nomoreproblem'></textarea>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
abelCommented:
@ali: the cols/rows are deprecated in favor of CSS width/height.
0
 
DanSmirAuthor Commented:
10x!!!!
0
 
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"
0
 
abelCommented:
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
  %attrs;
  %focus;
  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

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now