“最小宽度"在表单"input [type =" button"]元素上不起作用吗? [英] Does `min-width` not work on form `input[type="button"]` elements?

查看:97
本文介绍了“最小宽度"在表单"input [type =" button"]元素上不起作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人看到它为什么不起作用的原因吗? (适用于width,但不适用于min-width)

Anyone see a reason why this isn't working? (works with width, just not min-width)

input[type="button"] {
    min-width: 100px;
}

修改:

  • 按钮"选择器与width一起使用, 只是不是min-width
  • min-width与其他元素一起使用,只是不起作用 按钮"选择器
  • 开启 铬/野生动物园.不是IE问题.
  • "button" selector works with width, just not min-width
  • min-width works with other elements, just not "button" selector
  • This is on chrome/safari. Not an IE issue.

推荐答案

我也遇到了这个问题. min-width确实可以工作,但是可能由于默认box-sizingborder-box的按钮而无法为您提供预期的结果,或者可能无法正常工作.尝试在按钮上设置box-sizing: content-box.

I just ran into this problem too. min-width does work, but might not give you the results you expect or might appear not to work due to buttons having a default box-sizing of border-box. Try setting box-sizing: content-box on the button.

这篇关于“最小宽度"在表单"input [type =" button"]元素上不起作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆