Skip to content

Commit

Permalink
better select tag experience (Chrome and Firefox only)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrliptontea committed Feb 28, 2015
1 parent bdf4713 commit e2a0c5e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
38 changes: 33 additions & 5 deletions src/sass/components/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,44 @@ select {
height: auto;
}

option {
padding-right: $input-padding-horizontal;
padding-left: $input-padding-horizontal;
option[disabled] {
color: $gray-lighter;
}
}

/**
* Browser hacks: unfortunately every browser has different capabilities when it
* comes to styling <select> and <option> tags.
*/


// Mozilla Firefox
@-moz-document url-prefix() {
select {
&[multiple] {
padding: 0;
}

&[disabled] {
color: $gray-lighter;
option {
padding: $input-padding-vertical $input-padding-horizontal;
border-bottom: 1px dotted $gray-lighter;
}
}
}

// Google Chrome and Safari
@supports (-webkit-appearance: none) {
select[multiple] {
padding: 0;
}

// For some reason nested selectors will not work
select[multiple] option {
padding: $input-padding-vertical $input-padding-horizontal;
border-bottom: 1px dotted $gray-lighter;
}
}

select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
Expand Down
10 changes: 9 additions & 1 deletion stylesheets/application.css

Large diffs are not rendered by default.

0 comments on commit e2a0c5e

Please sign in to comment.