Skip to content

Instantly share code, notes, and snippets.

@jquerygeek
Created February 26, 2013 00:50
Show Gist options
  • Save jquerygeek/5034799 to your computer and use it in GitHub Desktop.
Save jquerygeek/5034799 to your computer and use it in GitHub Desktop.
SASS/COMPASS code
// buttons look simple
button {
margin: 0;
padding: 0;
background: none;
border: 0;
cursor: pointer;
font-family: inherit;
font-size: inherit;
outline: none;
}
//Inner padding and border oddities in FF
button::-moz-focus-inner {
padding: 0;
border: 0;
}
.oBtn {
cursor: pointer;
border: none;
display: inline-block;
background: transparent;
font: bold 13px sans-serif;
line-height: 24px;
border-radius:6px;
background-clip: padding-box;
padding: 5px 14px 3px;
outline: none;
&.isDisabled, &[disabled], &.isDisabled:active, &[disabled]:active, &.isDisabled:hover, &[disabled]:hover {
color: #a7a7a2;
border: 1px solid #e0e0de;
@include box-shadow(none);
text-shadow: none;
background: #f0f0ee;
cursor: default;
}
&:hover {
text-decoration: none;
}
-webkit-font-smoothing: antialiased;
font-smoothing: always;
}
.oBtnPrimary {
color: #ffffff;
@include background-with-css2-fallback(#7ada4a linear-gradient(top, #7ada4a, #62c831 95%, #53bf29));
border: 1px solid #509e19;
border-bottom-color: #198d0f;
border-top-color: #6dbe38;
@include box-shadow(0px 1px 3px rgba(38,151,72, .5), inset 0px 1px 0px rgba(159,230,98,1));
text-shadow: 0px 1px 0px rgba(37,168,17,1);
height: 34px;
&:hover {
@include background-with-css2-fallback(#93dd64 linear-gradient(top, #93dd64, #72d239 95%, #6fcc37));
@include box-shadow(0px 1px 3px rgba(38,151,72, .5), inset 0px 1px 0px rgba(173,236,102,1));
border: 1px solid #6dbe38;
border-bottom: 1px solid #198d0f;
}
&:active {
@include background-with-css2-fallback(#6ec54f linear-gradient(top, #6ec54f, #56b92d));
border: 1px solid #239365;
@include box-shadow(none);
}
}
.oBtnVisitorPrimary {
@extend .oBtnPrimary;
}
.oBtnSecondary {
color: #636360;
@include background-with-css2-fallback(#f1f1ee linear-gradient(top, #f1f1ee, #e3e3e1 95%, #dddddb));
border: 1px solid #cdcdc6;
border-bottom: 1px solid #B2AFB4;
@include box-shadow(0px 2px 2px rgba(0,0,0,0.1));
text-shadow: 0px 1px 0px rgba(255,255,255,.8);
//set height, because ff doesn't not allow to change line-height in inputs https://bugzilla.mozilla.org/show_bug.cgi?id=349259
height: 34px;
&:hover {
color: #6d696f;
@include background-with-css2-fallback(#f5f5f4 linear-gradient(top, #f5f5f4, #e8e8e6 95%, #dededd));
border: 1px solid #ccc9d0;
border-bottom-color: #b2afb4;
text-shadow: 0px 1px 0px rgba(255,255,255,.8);
}
&:active {
color: #6d696f;
background: #CECECB;
border: 1px solid #b1b1ae;
@include box-shadow(none);
text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
}
.oBtnTertiary, .oBtnCancel {
@extend a;
padding: 16px 8px 14px;
font-size: 13px;
font-weight: bold;
}
.oBtnLarge + .oBtnCancel {
font-size: 14px;
}
.oBtnSubtle {
@extend a;
border-radius: 5px;
padding: 5px 8px 6px;
font-size: 11px;
font-weight: bold;
border: 2px solid #CCC;
line-height: 1;
}
.oBtnFavorite {
@extend .oActionLink;
&:before {
margin-right: 5px;
@extend .oFavoriteIcon;
}
&:hover:before {
@extend .oFavoriteIcon:hover;
}
}
.oBtnFavoriteAdd {
@extend .oBtnFavorite;
}
.oBtnFavoriteEdit {
@extend .oBtnFavorite;
&:before {
@extend .oFavoriteSavedIcon;
}
&:hover:before {
@extend .oFavoriteSavedIcon;
}
}
// Jumbo Button
.oBtnJumbo {
margin-bottom: 33px;
display: block;
font-size: 18px;
padding: 12px 24px;
font-weight: 600;
height: 50px;
}
.oBtnLarge {
height: 46px;
font-size: 14px;
padding: 11px 18px 9px;
}
.oBtnSubtle {
@extend a;
border-radius: 5px;
padding: 0 8px;
font-size: 11px;
font-weight: bold;
border: 2px solid #CCC;
line-height: 24px;
height: 26px;
}
// Multi-part Buttons (extends ul)
$multi-button-border-radius: 6px;
.oMultiButton {
>li {
@include inline-block;
zoom: 1;
border: none;
padding: 0;
}
>li:first-child button {
margin: 0;
@include border-radius($multi-button-border-radius 0 0 $multi-button-border-radius);
}
>li:last-child button {
margin-left: -1px;
@include border-radius(0 $multi-button-border-radius $multi-button-border-radius 0);
}
>li button {
margin: 0 0 0 -1px;
@include border-radius(0);
}
}
.oBtnClose {
cursor: pointer;
@extend .oPopupDarkCloseIcon;
&:hover {
@extend .oPopupDarkCloseIcon:hover;
}
}
.oBtnCloseSmall {
font-size: 17px;
font-family: monospace;
font-weight: bold;
color: darken($background-color, 42);
margin-left: 5px;
&:before {
display: inline-block;
content: "×";
}
}
.oBtnInline {
padding: 4px 14px;
}
.oBtnSml {
padding: 1em;
font-size: .9em;
}
.oBtnCloseMessage {
@extend .oBtnCloseSmall;
@include opacity(0.5);
&:hover {
@include opacity(1);
}
}
.oBtnPopup {
@extend a;
}
.oBtnChat {
display: block;
width: 225px;
margin-top: 20px;
&:before {
content: "";
margin-right: 10px;
vertical-align: middle;
@extend .oChatIcon;
}
}
.oBtnCloseSmall {
display: inline-block;
width: 9px;
height: 9px;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Igkgd2lkdGg9IjlweCIgaGVpZ2h0PSI5cHgiIHZpZXdCb3g9IjAgMCA5IDkiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDkgOSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGc+CTxnPgkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiM4NjgyODIiIGQ9Ik02LjU5Niw0LjUwNGwxLjk3Ny0xLjk4N2MwLjU4Ni0wLjU4NiwwLjU4Ni0xLjUzNiwwLTIuMTIyCQkJYy0wLjU4Ni0wLjU4NS0xLjUzNS0wLjU4NS0yLjEyMSwwTDQuNDczLDIuMzg1TDIuNTQxLDAuNDU3Yy0wLjU4MS0wLjU4My0xLjUyMy0wLjU4My0yLjEwNSwwYy0wLjU4MSwwLjU4My0wLjU4MSwxLjUyOSwwLDIuMTEzCQkJTDIuMzY5LDQuNWwtMS45MywxLjk0Yy0wLjU4NiwwLjU4Ni0wLjU4NiwxLjUzNSwwLDIuMTIxczEuNTM2LDAuNTg2LDIuMTIyLDBsMS45MzEtMS45NDFsMS45NDcsMS45NDMJCQljMC41ODIsMC41ODQsMS41MjUsMC41ODQsMi4xMDUsMGMwLjU4Mi0wLjU4NCwwLjU4Mi0xLjUyOSwwLTIuMTEzTDYuNTk2LDQuNTA0eiIvPgk8L2c+PC9nPjwvc3ZnPg==) no-repeat;
background-position: 50%;
margin: 0 7px 0 0;
text-indent: -9999px;
}
.oBtnCloseMini {
display: inline-block;
background-image: inline-image("/close-icon-mini.svg");
margin-left: 5px;
vertical-align: middle;
height: 9px;
width: 10px;
&:hover {
background-image: inline-image("/close-icon-mini-hover.svg");
}
}
.oBtnActionExt {
position: relative;
font-weight: bold;
color: $link-color;
border: 3px solid #E6E4E4;
&:before {
content: "";
position: absolute;
}
&:hover {
text-decoration: none;
}
}
.oBtnAction {
@extend .oBtnActionExt;
font-size: 13px;
padding: 9px 10px 7px 33px;
border-radius: 7px;
&:before {
top: 9px;
left: 10px;
width: 15px;
height: 15px;
@include background-size(15px 15px);
}
}
.oBtnActionSmall {
@extend .oBtnActionExt;
font-size: 11px;
padding: 7px 8px 5px 27px;
border-width: 2px;
border-radius: 5px;
&:before {
top: 6px;
left: 8px;
width: 13px;
height: 13px;
@include background-size(12px 12px);
}
}
.oBtnDelete {
@extend .oBtnAction;
&:before {
@extend .oDeleteIcon;
}
}
.oBtnDeleteSmall {
@extend .oBtnActionSmall;
&:before {
@extend .oDeleteIcon;
}
}
.oTag:hover > .oBtnCloseMini, .oTag.isSelected > .oBtnCloseMini {
@extend .oBtnCloseMini:hover;
}
.oBtnEdit {
@extend .oBtnAction;
&:before {
@extend .oEditIcon;
}
}
.oBtnEditSmall {
@extend .oBtnActionSmall;
&:before {
@extend .oEditIcon;
}
}
.oBtnGrp {
vertical-align: middle;
display: inline-block;
> input + label {
@include box-shadow(0 1px 1px #e2e2e2);
float: left;
padding: 6px 15px;
background: #eee;
border: 1px solid #d6d6d6;
border-right: none;
color: #767676;
font-weight: bold;
text-align: center;
cursor: pointer;
&:first-of-type {
border-radius: 6px 0 0 6px;
}
&:last-of-type {
border-radius: 0 6px 6px 0;
border-right: 1px solid #d6d6d6;
}
}
> input {
position: absolute;
visibility: hidden;
&:checked + label,
&:focus + label {
@include box-shadow(0 0 0 transparent, inset 0px 2px 0px #0093ed);
background: #00adf2;
border-color: #2090bd;
border-right: 1px solid #2090bd;
color: white;
}
&:active + label {
outline: none;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment