Specify width of 3 chars for an html input text

前端 未结 2 690
伪装坚强ぢ
伪装坚强ぢ 2021-02-18 19:10

How would I create an HTML text box that exactly 3 characters can fit into it?
I found this online:

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-18 19:36

    Not reliably, since l and W have very different widths.

    However, if you set the font to monospace, that helps. Then, you should be able to set size="3" on the input element, and in theory it should be exactly three characters wide.

提交回复
热议问题