Width of input type=text element

前端 未结 4 1041
名媛妹妹
名媛妹妹 2020-12-31 04:00

How come when I do this:


4条回答
  •  太阳男子
    2020-12-31 04:12

    The visible width of an element is width + padding + border + outline, so it seems that you are forgetting about the border on the input element. That is, to say, that the default border width for an input element on most (some?) browsers is actually calculated as 2px, not one. Hence your input is appearing as 2px wider. Try explicitly setting the border-width on the input, or making your div wider.

提交回复
热议问题