HTML Attributes
HTML size attribute
On applicable text inputs, suggests width in characters; on select, specifies a visible option count. It does not constrain the text length or number of choices. Applicable elements include: <input>, <select>. Check each element’s value rules.
Formal Syntax & Structure
html syntaxhtml
size="8"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| size | positive integer | On applicable text inputs, suggests width in characters; on select, specifies a visible option count. It does not constrain the text length or number of choices. |
Working Example
Example Snippethtml
<label> Code <input size="8" maxlength="12"></label>Browser Compatibility
Minimum supported versions across modern rendering engines
Blink (modern)
Chrome
1
Yes
EdgeHTML / Blink
Edge
12
Yes
Gecko
Firefox
1
Yes
WebKit
Safari
1
Yes
Presto / Blink
Opera
≤12.1
Yes
Desktop support for size on input only; other elements, input types, individual values and mobile behavior may differ.
HTML Living Standard