Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

how to adjust the size of a textbox??

hi, How do i edit a the size of a text box in HTML?
1 Solution
<TEXTAREA NAME="name_goes_here"
ROWS=40 COLS=65 WRAP=physical></TEXTAREA>

for a text area

<INPUT TYPE="text" NAME="name_goes_here" Size=80>

for a text box

Hope that helps.
or use CSS:

<input type="text" name="myText" style="width:250px">

style sheet:

<!-- goes in the head tags -->
    .data {

<input type="text" name="myText" class="data">
also, the height of the textbox will change depending on the font type and font size in the textbox

you can do this:

<input type="text" style="font-family:verdana; font-size:14;">
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

pls try following html

  <form name="frm">
    <input type="text" name="txt" size="10">
    <input type="button" name="b1" value="size 20" onClick="frm.txt.size = 20;">
    <input type="button" name="b2" value="size 10" onClick="frm.txt.size = 10;">
The maxlength attribute will stop users typing in too much to your textbox as well, so, say you wanted to have a field for date input and you wanted the textbox to be a certain size to match others on the page, but didn't want people to type tons of stuff, you could use the follwing:

  <input type="text" name="txtboxname" size="15" maxlength="10" />
  <input type="submit" />

10 characters would allow nothing greater than, for example, 26/04/2003 to be entered.  Obviously, where a date is concerned, lots more checking is required :) but maxlength is a good start and can help prevent long SQL injection attacks from people trying to type in too much into your txtbox trying to add stuff to SQL statements embedded in your code.
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the user does not know how to close the question, the options are here:


It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

points to umangjoshi


If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.



Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

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