-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Custom select box styling #127
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
Changes from all commits
9af448e
2e57103
6b71ca9
2b56e65
047edbe
fd2bfd5
838effd
9854cd6
c490df9
324f630
e9b4f2c
7cf7bac
6a0719d
e312b89
6c19797
aa02645
244a732
fcf1c00
962898a
1159eb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ input[type="email"], | |
| input[type="number"], | ||
| input[type="tel"], | ||
| input[type="url"], | ||
| select, | ||
| textarea { | ||
| min-height: 34px; | ||
| padding: 7px 8px; | ||
|
|
@@ -41,6 +42,13 @@ textarea { | |
| } | ||
| } | ||
|
|
||
| select { | ||
| &:not([multiple]) { | ||
| height: 34px; | ||
| vertical-align: middle; | ||
| } | ||
| } | ||
|
|
||
| // Inputs with contrast for easy light gray backgrounds against white. | ||
| // input.class is needed here to increase specificity over input[…] | ||
| input.input-contrast, | ||
|
|
@@ -91,6 +99,7 @@ dl.form { | |
| input[type="password"], | ||
| input[type="email"], | ||
| input[type="url"], | ||
| select, | ||
| textarea { | ||
| background-color: #fafafa; | ||
|
|
||
|
|
@@ -469,3 +478,40 @@ input::-webkit-inner-spin-button { | |
| color: $brand-red; | ||
| content: "\f02d"; // octicon-x | ||
| } | ||
|
|
||
|
|
||
| // Custom select | ||
| // | ||
| // Apply `.select` to any `<select>` element for custom styles. | ||
|
|
||
| .select { | ||
| display: inline-block; | ||
| padding: 7px 24px 7px 8px; | ||
| vertical-align: middle; | ||
| background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAaCAMAAACNQ/wIAAAAYFBMVEUzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMS2aZBAAAAH3RSTlMAAQYNDg8VJDQ2N0JbdXZ4h4mKpL3Iycvb6vDx8vn+GLdSCAAAAHBJREFUeNq90TcSgDAMRFGRMwZMTnv/W+IBm6BxzSt/pUBGURKT73v+LdkGbNm7xDOUOXlKNOE0RaaEI7QxvIrX4db5pLgtXlqXyJH4kA5VYCr6Xw2msYxqWUgJetyGwH4cfkIjXaCsqfUd/GmMEKQdADIVzQIQilIAAAAASUVORK5CYII=) no-repeat right 8px center; | ||
| background-size: 9px 13px; | ||
| box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.075); | ||
| // Have to include vendor prefixes as the `appearance` property isn't part of the CSS spec. | ||
| -webkit-appearance: none; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid vendor prefixes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid vendor prefixes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid vendor prefixes. |
||
| -moz-appearance: none; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid vendor prefixes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely, we have autoprefixer for that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure appearance isn't covered by autoprefixer. When I drop it down to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a comment to the code for why we need this—autoprefixer only prefixes properties that are in the spec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid vendor prefixes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid vendor prefixes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess houndci doesn't like it. :-/ |
||
| appearance: none; | ||
|
|
||
| &:focus { | ||
| outline: none; | ||
| border-color: #51a7e8; | ||
| box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075), 0 0 5px rgba(81, 167, 232, 0.5); | ||
| } | ||
|
|
||
| // Hides the caret in IE11 | ||
| &::-ms-expand { | ||
| opacity: 0; | ||
| } | ||
| } | ||
|
|
||
| .select-sm { | ||
| height: 26px; | ||
| min-height: 26px; | ||
| padding-top: 3px; | ||
| padding-bottom: 3px; | ||
| font-size: 12px; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't typically base64 images, but not saying it's a bad thing. Just asking the obvious if we're cool with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine doing this as a static asset someplace, but would need advice as to how we set that up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it as base64 since Primer itself has no CDN.