Firefox/Safari setting height as [specified height - padding - border] for input[type=button]

前端 未结 4 2154
南旧
南旧 2021-02-15 03:45

When I use the following CSS:

input[type=button] {
  background-color: white;
  border: 1px solid black;
  font-size: 15px;
  height: 20px;
  padding: 7px;
}
         


        
4条回答
  •  一向
    一向 (楼主)
    2021-02-15 04:35

    It makes sense because the height of the element is naturally more than what you set it to. input elements are assigned a height which, in this case, should be enough to contain the text of your element but you set it to a smaller amount. To show this, remove your height setting.

提交回复
热议问题