Categories
- HTML Books
- HTML Colors
- HTML Characters
- HTML Tags
- <!--...-->
- <!doctype>
- <a>
- <abbr>
- <acronym>
- <address>
- <applet>
- <area>
- <b>
- <base>
- <basefont>
- <bdo>
- <big>
- <blockquote>
- <body>
- <br>
- <button>
- <caption>
- <center>
- <cite>
- <code>
- <col>
- <colgroup>
- <dd>
- <del>
- <dfn>
- <dir>
- <div>
- <dl>
- <dt>
- <em>
- <fieldset>
- <font>
- <form>
- <frame>
- <frameset>
- <h1>
- <h2>
- <h3>
- <h4>
- <h5>
- <h6>
- <head>
- <hr>
- <html>
- <i>
- <iframe>
- <img>
- <input>
- <ins>
- <isindex>
- <kbd>
- <label>
- <legend>
- <li>
- <link>
- <map>
- <menu>
- <meta>
- <noframes>
- <noscript>
- <object>
- <ol>
- <optgroup>
- <option>
- <p>
- <param>
- <pre>
- <q>
- <s>
- <samp>
- <script>
- <select>
- <small>
- <span>
- <strike>
- <strong>
- <style>
- <sub>
- <sup>
- <table>
- <tbody>
- <td>
- <textarea>
- <tfoot>
- <th>
- <thead>
- <title>
- <tr>
- <tt>
- <u>
- <ul>
- <var>
- HTML Tutorial
- HTML Software
- HTML Validator
Tools
Partners
HTML <input> Tag
Description:
The <input> tag is used within a form to declare an input element - a control that allows the user to input data.
Specific Attributes:
| Attribute | Definition |
| type |
Specifies the type of control. Possible values:
|
| name | Assigns a name to the input control. |
| value | Specifies the value of an input element |
| size | Specifies the width of an input field |
| maxlength | Specifies the maximum length (in characters) of an input field (for type="text" or type="password") |
| checked | If type="radio" or type="checkbox" it will already be selected when the page loads. |
| src | If type="image", this attribute specifies the location of the image. |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| align | For alignment (left, center, right, justify). |
| alt | Alternate text. This specifies text to be used in case the browser/user agent can't render the input control. |
| accept | Specifies a comma-separated list of content types that the server accepts. |
| readonly | Sets the input control to read-only - it won't allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls. |
| disabled | Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing. |
| tabindex | Specifies the tab order of an element. |
| accesskey | Specifies a keyboard shortcut to access an element. |
Example Code:
<form action="" method="post">
First name: <input type="text" name="first_name" /><br />
Last name: <input type="text" name="last_name" /><br />
<input type="submit" value="Submit" />
</form>
Result



