HTML 属性:size

HTML 属性:size

尝试一下

label {

display: block;

margin-top: 1rem;

}

示例

通过在某些输入类型上添加 size 可以控制输入的宽度。在选择项上添加 size 会改变高度,从而定义在关闭状态下有多少选项是可见的。

html

规范

Specification

HTML# attr-select-size

HTML# attr-input-size

浏览器兼容性

html.elements.select.size

Loading…

html.elements.input.size

Loading…

参见

maxlength

minlength

pattern

Help improve MDN

Was this page helpful to you?

Yes

No

Learn how to contribute

This page was last modified on ⁨2025年8月6日⁩ by MDN contributors.

View this page on GitHub • Report a problem with this content

黄金推荐

聊五毛钱的是什么梗
365bet娱乐

聊五毛钱的是什么梗

✨ 06-29 💎 价值: 1932
五种常见的电子商务模式对比:B2B、B2C、C2B、C2C、O2O
beat365手机客户端下载

五种常见的电子商务模式对比:B2B、B2C、C2B、C2C、O2O

✨ 07-19 💎 价值: 8256
体育世界杯球迷纪念品热潮掀起 全球收藏热度与文化传承的融合之路