input type text – How to use simple and CSS styled text boxes

Input type text

The input type = “text” specifies a textbox field. By default the width of textbox field is 20 characters. This is where you can ask visitors to enter information like name, email, address etc.

An input textbox example

The example below shows a form with three text boxes. Name, email and address.

CSS input text

You can apply CSS to text fields. In order to specify CSS to input textbox you can use a class created in CSS or also can use style attribute inside <input type=text>. The example below uses same form as above. The first textbox is given CSS created in <head> section. While other textbox uses CSS at inline level by using style attribute. Both text boxes are given border with green and orange colors, the entered text is also different for both boxes.

Also see HTML form | HTML table | HTML div | HTML links

Was this article helpful?

Related Articles

Leave A Comment?