HTML5 日期和时间输入的本机控件定位

奎兹

如果我将自定义高度设置为<input type="date" />元素,则悬停时出现的本机控件(向上和向下按钮)将与输入的顶部而不是中心对齐。

input {
  height: 40px;
}
<input type="date" />

type="time"输入也会发生同样的情况,但不会发生type="number". 如何将这些按钮定位到输入的中心(垂直)?

利夫尼马尔卡

使用padding替代height

input {
      padding: 10px 0px 10px 0px;
}
<input type="date" />

使用 height

input {
  height: 40px;
}
input[type=date]::-webkit-inner-spin-button {
margin-top: 10px!important;
}



input[type=date]::-webkit-calendar-picker-indicator {
margin-top: 10px!important;
}
<input type="date" />

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章