例
HTML表單與35個和4個字符寬度兩個輸入字段:
<form
action="demo_form.asp">
Email: <input type="text" name="email" size="35"><br>
PIN: <input type="text" name="pin" maxlength="4" size="4"><br>
<input type="submit" value="Submit">
</form>
試一試» 定義和用法
在size屬性指定可見寬度,以字符的的<input>元素。
注: size屬性適用於以下輸入類型: text, search, tel, url, email和password 。
提示:要指定允許的字符的最大數量<input>元素,使用maxlength屬性。
瀏覽器支持
在表中的數字指定完全支持屬性所述第一瀏覽器的版本。
屬性 | |||||
---|---|---|---|---|---|
size | 1.0 | 2.0 | 1.0 | 1.0 | 1.0 |
HTML 4.01和HTML5之間的差異
沒有。
句法
<input size="number">
屬性值
值 | 描述 |
---|---|
number | 指定的寬度<input>元素,以字符。 默認值是20 |