Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add input type number spinner styling #200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,13 @@
<label for="text${getNewId()}">Search</label>
<input id="text${getCurrentId()}" type="search" value="98 css"/>
</div>
<div class="number-input">
<input type="number" id="text${getNewId()}" min="1980" max="2099" value="1998">
<div class="number-input-controls">
<button aria-label="Up"></button>
<button aria-label="Down"></button>
</div>
</div>
`) %>

</div>
Expand Down
3 changes: 3 additions & 0 deletions icon/input-control-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icon/input-control-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 48 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,60 @@ input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
select {
height: 21px;
}

.number-input {
display: flex;
gap: 1px;
}

.number-input-controls {
display: flex;
flex-direction: column;
justify-content: center;
}

.number-input-controls button:focus {
outline: none;
}

.number-input-controls button[aria-label="Up"],
.number-input-controls button[aria-label].up,
.number-input-controls button[aria-label="Down"],
.number-input-controls button[aria-label].down {
min-width: 15px;
min-height: 10px;
padding: 0;
background-repeat: no-repeat;
background-position: bottom;
}

.number-input-controls button[aria-label="Up"],
.number-input-controls button[aria-label].up {
background-image: svg-load("./icon/input-control-up.svg");
}

.number-input-controls button[aria-label="Down"],
.number-input-controls button[aria-label].down {
background-image: svg-load("./icon/input-control-down.svg");
}

input[type="number"] {
/* need this 1 pixel to fit the spinner controls in box */
height: 22px;
-webkit-appearance: textfield;
-moz-appearance: textfield;
appearance: textfield;
padding-right: 32px;
}

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

/* clears the ‘X’ from Internet Explorer */
input[type=search]::-ms-clear { display: none; width : 0; height: 0; }
input[type=search]::-ms-reveal { display: none; width : 0; height: 0; }
Expand Down