如何从 Opera 中的 input[type="number"] 中删除箭头 [英] How to remove the arrows from input[type="number"] in Opera

查看:24
本文介绍了如何从 Opera 中的 input[type="number"] 中删除箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想去掉这些箭头,在某些情况下很方便.

Just looking to remove these arrows, convenient in certain situations.

我想保留浏览器对纯数字内容的感知.因此,将其更改为 input[type="text"] 是不可接受的解决方案.

I would like to preserve the browser's awareness of the content being purely numeric however. So changing it to input[type="text"] is not an acceptable solution.

既然 Opera 是基于 webkit 的,这个问题是重复的:我可以隐藏 HTML5 数字输入的旋转框吗?

Now that Opera is webkit based, this question is a dulpicate of: Can I hide the HTML5 number input’s spin box?

推荐答案

我一直在使用一些简单的 CSS,它似乎删除了它们并且工作正常.

I've been using some simple CSS and it seems to remove them and work fine.

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin: 0; 
}

<input type="number" step="0.01"/>

本教程来自 CSS Tricks 详细讲解 &还展示了如何设置它们的样式

这篇关于如何从 Opera 中的 input[type="number"] 中删除箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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