HTML Text Box Code

You can use the following code as a basis for adding a text box to your website. This will enable your users to provide multi-line comments. Most browsers will render scroll bars on the text box as soon as its contents are too big for it.

To make this text box do something, simply place it within a form that submits the contents to the server for processing.

Basic Text Box

Customizing your Text Box

You can change the color, add borders, and add a background picture to your text box. Here are some examples.

Color

More Comment Box Colors →

Background Image

More Comment Box Pictures →

Borders

More Comment Box Borders →

Scrollbars

More Scrollbars →

Text Box Templates

You can also change things about your text box such as the size, how many rows/columns it has, and much more.

You modify your text box by changing the value of the attributes. Attributes are the bit that look something like someattribute="somevalue" (for example, cols="40" ).

You can use the following templates as a basis for your HTML text box codes. Simply fill in the blanks or remove uneeded attributes.

1. The Text Box Tag

For an explanation of all the attributes, see the textarea.

<textarea
	name=""
	rows=""
	cols=""
	class=""
	id=""
	dir=""
	lang=""
	title=""
	style=""
	readonly=""
	disabled=""
	tabindex=""
	onfocus=""
	onblur=""
	onselect=""
	onchange=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup=""
>

</textarea>

2. The HTML Form Tag

Note that text boxes are part of an HTML form. The HTML form tag also accepts its own attributes, as follows:

For an explanation of all the attributes, see form.

<form
	action=""
	method=""
	enctype=""
	accept-charset=""
	accept=""
	name=""
	class=""
	id=""
	dir=""
	lang=""
	target=""
	onSubmit=""
	onReset=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup=""
>

</form>