Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

customize appearance of up/down arrows in html number inputs

<!DOCTYPE html>
<html>
<head>
<style>
input[type="number"] {
  height: 32px;
  border-radius: 4px;
  border: 1px solid #d8d8d8;
  position: relative;
  text-align: center;
  font-size: 20px;
  width: 80px;
  outline: none;
  background-image: url('data:image/svg+xml;utf8,%3Csvg%20version%3D%221.1%22%20viewBox%3D%220%200%2050%2067%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20stroke-width%3D%222%22%3E%3Cline%20x1%3D%221%22%20x2%3D%2250%22%20y1%3D%2233.5%22%20y2%3D%2233.5%22%20stroke%3D%22%23D8D8D8%22%2F%3E%3Cpolyline%20transform%3D%22translate(25%2020)%20rotate(45)%20translate(-25%20-20)%22%20points%3D%2219%2026%2019%2014%2032%2014%22%20stroke%3D%22%23000%22%2F%3E%3Cpolyline%20transform%3D%22translate(25%2045)%20rotate(225)%20translate(-25%20-45)%22%20points%3D%2219%2052%2019%2039%2032%2039%22%20stroke%3D%22%23000%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
  background-position: center right;
  background-size: contain;
  background-repeat: no-repeat;
  caret-color: transparent;
}

input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  opacity: 1 !important;
  background: transparent !important;
  border-width: 0px;
  margin: 0;
  border-left: 1px solid #d8d8d8;
  height: 34px;
  width: 23px;
  cursor: pointer;
}
</style>
</head>
<body>
<center>
<h1>Css for number type input's arrows.</h1>
<br>
<input type="number" value="0">
</center>
</body>
</html>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #customize #appearance #arrows #html #number #inputs
ADD COMMENT
Topic
Name
8+9 =