0

I am trying to make the css of input type number just like in the Google Chrome. but it is not working in my mozila browser.

image

I don't know how to make it just like it is seen in Google chrome.

input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    cursor:pointer;
    display:block;
    width:8px;
    color: #333;
    text-align:center;
    position:relative;
  }

  input[type=number]::-webkit-inner-spin-button:before,
  input[type=number]::-webkit-inner-spin-button:after {
    content: "^";
    position:absolute;
    right: 0;
    font-family:monospace;
    line-height:1px;
  }

  input[type=number]::-webkit-inner-spin-button:before {
    top:0px;
  }

  input[type=number]::-webkit-inner-spin-button:after {
    bottom:0px;
    -webkit-transform: rotate(180deg);
  }
<input type="number" value="10" max="15">

3
  • that is an html5 input type that is not supported by all versions of browsers Commented Feb 6, 2017 at 15:58
  • That looks like an ASP textbox control using TextMode="Number" rendered in Chrome. Commented Feb 6, 2017 at 15:59
  • yes.. but i want to make it same for all browsers and want to give css as seen in google chrome. Commented Feb 6, 2017 at 16:00

1 Answer 1

1

That's because you can't use pseudo classes on the ::webkit-inner-spin-button.

See this for a working example

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. source

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

yes.. but i want to make it same for all browsers and want to give css as seen in google chrome.
Right, the example linked above does that – but ::webkit prefixes by definition won't work in every browser
can't I use for mozilla by putting prefix as -moz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.