Name
SIZE — NN all IE all HTML all
Synopsis
SIZE=”elementWidth"
Optional
In practice, the SIZE
attribute is limited to
describing the character width of text field INPUT
elements. The actual rendered width is calculated based on the font
setting (or default font) for the element, but the results are not
always perfect. Variations in font rendering (and the ability to
specify alternate font faces and sizes in Internet Explorer)
sometimes lead to unexpectedly narrower fields. Therefore, it is not
wise to automatically set the SIZE
and
MAXLENGTH
attributes to the same value without
testing the results on a wide variety of browsers and operating
systems with worst-case data (for example, all “m” or
“W” characters in proportional fonts). The HTML 4.0
specification indicates that the SIZE
attribute
might be applied to other INPUT
element types, but
as of the Version 4 browsers, this is not the case. In the meantime,
you can use CSS-Positioning to make buttons wider than the default
size that tracks the width of the VALUE
attribute
string.
Input Types
password
, text
Example
<INPUT TYPE="text" NAME="ZIP" MAXLENGTH=10 SIZE=12>
Value
Any positive integer.
Default
20
Object Model Reference
- IE
[window.]document.formName.inputName.size
[window.]document.forms[i].elements[i].size
[window.]document.all.elementID.size
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.