Specify width of 3 chars for an html input text

前端 未结 2 691
伪装坚强ぢ
伪装坚强ぢ 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:29

    Use the ch metric.

    width: 3ch;
    

    Make sure your box-sizing property is set to content-box if you're changing left and/or right padding.

提交回复
热议问题