Ask Your Question
4

Is it possible to conceal the spin box of the HTML5 number input?

asked 2022-12-07 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-03-30 01:00:00 +0000

pufferfish gravatar image

Yes, it is possible to conceal the spin box of the HTML5 number input using CSS. Here's how:

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

input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

This CSS code will hide the spin box in Chrome, Safari, and other WebKit-based browsers. The spin box will still be visible in Firefox, but the -moz-appearance: textfield; rule will make it look like a regular text input.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-12-07 11:00:00 +0000

Seen: 1 times

Last updated: Mar 30 '22